diff --git a/gio/gdbusaddress.c b/gio/gdbusaddress.c index 0983ac49c..b73ff0d6e 100644 --- a/gio/gdbusaddress.c +++ b/gio/gdbusaddress.c @@ -53,6 +53,12 @@ #include #endif +#ifdef G_OS_WIN32 +#define FO_CLOEXEC "" +#else +#define FO_CLOEXEC "e" +#endif + #include "glibintl.h" /** @@ -711,7 +717,7 @@ g_dbus_address_connect (const gchar *address_entry, int errsv; /* be careful to read only 16 bytes - we also check that the file is only 16 bytes long */ - f = fopen (nonce_file, "rb"); + f = fopen (nonce_file, "rb" FO_CLOEXEC); errsv = errno; if (f == NULL) { diff --git a/gio/gunixmounts.c b/gio/gunixmounts.c index 9a02de3b5..4a2f0a248 100644 --- a/gio/gunixmounts.c +++ b/gio/gunixmounts.c @@ -3166,7 +3166,7 @@ _resolve_dev_root (void) /* see if device with similar major:minor as /dev/root is mention * in /etc/mtab (it usually is) */ - f = fopen ("/etc/mtab", "r"); + f = fopen ("/etc/mtab", "re"); if (f != NULL) { struct mntent *entp; diff --git a/glib/gcharset.c b/glib/gcharset.c index 31d46b659..82cd0a7b8 100644 --- a/glib/gcharset.c +++ b/glib/gcharset.c @@ -446,7 +446,7 @@ read_aliases (const gchar *file, FILE *fp; char buf[256]; - fp = fopen (file,"r"); + fp = fopen (file, "re"); if (!fp) return; while (fgets (buf, 256, fp))