diff options
author | Andrew Walton <awalton@vmware.com> | 2013-11-12 13:04:49 -0800 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2013-11-23 11:01:29 -0500 |
commit | 4382e8b876a3991e1be2827be76630e1b67b8e03 (patch) | |
tree | e0b3cf79bfeb7e78dc2d2f42decb8012e4674503 /gio/gsubprocess.c | |
parent | f969f1fc25248d4f53c78568481205b21ef1446b (diff) | |
download | glib-4382e8b876a3991e1be2827be76630e1b67b8e03.tar.gz glib-4382e8b876a3991e1be2827be76630e1b67b8e03.tar.bz2 glib-4382e8b876a3991e1be2827be76630e1b67b8e03.zip |
CLOEXEC fix for older FreeBSDs and OS X.
Some older POSIX-flavored operating systems may not have adopted
O_CLOEXEC yet.
See https://bugzilla.gnome.org/show_bug.cgi?id=712136.
Diffstat (limited to 'gio/gsubprocess.c')
-rw-r--r-- | gio/gsubprocess.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gio/gsubprocess.c b/gio/gsubprocess.c index ca9b00607..bced7a5e3 100644 --- a/gio/gsubprocess.c +++ b/gio/gsubprocess.c @@ -108,6 +108,12 @@ #define O_BINARY 0 #endif +#ifndef O_CLOEXEC +#define O_CLOEXEC 0 +#else +#define HAVE_O_CLOEXEC 1 +#endif + #define COMMUNICATE_READ_SIZE 4096 /* A GSubprocess can have two possible states: running and not. @@ -356,6 +362,10 @@ unix_open_file (const char *filename, g_free (display_name); /* fall through... */ } +#ifndef HAVE_O_CLOEXEC + else + fcntl (my_fd, F_SETFD, FD_CLOEXEC); +#endif return my_fd; } |