mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 15:03:39 +02:00
Use O_CLOEXEC in {g_,}open () calls for race-free setting of the close-on-exec flag
The remaining call sites are either Windows-only, between fork () and exec () or in xdgmime copylib. Hope I haven't missed any site.
This commit is contained in:
committed by
Philip Withnall
parent
0f5d274871
commit
3f2e18b07c
@@ -37,6 +37,10 @@
|
||||
#include "gwin32sid.h"
|
||||
#endif
|
||||
|
||||
#ifndef O_CLOEXEC
|
||||
#define O_CLOEXEC 0
|
||||
#endif
|
||||
|
||||
#include "gdbusauthmechanismsha1.h"
|
||||
#include "gcredentials.h"
|
||||
#include "gdbuserror.h"
|
||||
@@ -519,7 +523,7 @@ create_lock_exclusive (const gchar *lock_path,
|
||||
int errsv;
|
||||
gint ret;
|
||||
|
||||
ret = g_open (lock_path, O_CREAT | O_EXCL, 0600);
|
||||
ret = g_open (lock_path, O_CREAT | O_EXCL | O_CLOEXEC, 0600);
|
||||
errsv = errno;
|
||||
if (ret < 0)
|
||||
{
|
||||
|
Reference in New Issue
Block a user