mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 15:03:39 +02:00
g_mkstemp: Use O_CLOEXEC for race-free setting of the close-on-exec flag
mkstemp-like family of functions also use g_open () under the hood so they should pass the O_CLOEXEC flag there for race-free setting of the close-on-exec flag.
This commit is contained in:
@@ -1040,7 +1040,7 @@ handle_overwrite_open (const char *filename,
|
||||
tmp_filename = g_build_filename (dirname, ".goutputstream-XXXXXX", NULL);
|
||||
g_free (dirname);
|
||||
|
||||
tmpfd = g_mkstemp_full (tmp_filename, (readable ? O_RDWR : O_WRONLY) | O_BINARY, mode);
|
||||
tmpfd = g_mkstemp_full (tmp_filename, (readable ? O_RDWR : O_WRONLY) | O_BINARY | O_CLOEXEC, mode);
|
||||
if (tmpfd == -1)
|
||||
{
|
||||
g_free (tmp_filename);
|
||||
|
Reference in New Issue
Block a user