mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-24 18:08:54 +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
@@ -45,6 +45,10 @@
|
||||
#include <io.h> /* For open() and close() prototypes. */
|
||||
#endif
|
||||
|
||||
#ifndef O_CLOEXEC
|
||||
#define O_CLOEXEC 0
|
||||
#endif
|
||||
|
||||
#include "gmoduleconf.h"
|
||||
#include "gstdio.h"
|
||||
|
||||
@@ -388,7 +392,7 @@ parse_libtool_archive (const gchar* libtool_name)
|
||||
GTokenType token;
|
||||
GScanner *scanner;
|
||||
|
||||
int fd = g_open (libtool_name, O_RDONLY, 0);
|
||||
int fd = g_open (libtool_name, O_RDONLY | O_CLOEXEC, 0);
|
||||
if (fd < 0)
|
||||
{
|
||||
gchar *display_libtool_name = g_filename_display_name (libtool_name);
|
||||
|
Reference in New Issue
Block a user