mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-30 04:13:06 +02:00
fileutils: Make some sample code detect symlinks as intended
The sample code here wasn't a race-free version of the race-susceptible anti-pattern, because it would have dereferenced a symlink automatically. Fixes: 293b4923 "Clarify g_file_test() docs about TOCTOU bugs" Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
parent
d5bf03cbcb
commit
f6e13753aa
@ -329,7 +329,7 @@ g_mkdir_with_parents (const gchar *pathname,
|
||||
* }
|
||||
*
|
||||
* // DO THIS INSTEAD
|
||||
* fd = g_open (filename, O_WRONLY);
|
||||
* fd = g_open (filename, O_WRONLY | O_NOFOLLOW);
|
||||
* if (fd == -1)
|
||||
* {
|
||||
* // check error
|
||||
|
Loading…
x
Reference in New Issue
Block a user