mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-22 17:08:53 +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:
@@ -329,7 +329,7 @@ g_mkdir_with_parents (const gchar *pathname,
|
|||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* // DO THIS INSTEAD
|
* // DO THIS INSTEAD
|
||||||
* fd = g_open (filename, O_WRONLY);
|
* fd = g_open (filename, O_WRONLY | O_NOFOLLOW);
|
||||||
* if (fd == -1)
|
* if (fd == -1)
|
||||||
* {
|
* {
|
||||||
* // check error
|
* // check error
|
||||||
|
Reference in New Issue
Block a user