[glib] CLOEXEC fix for older FreeBSDs and OS X.
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] CLOEXEC fix for older FreeBSDs and OS X.
- Date: Sat, 23 Nov 2013 16:01:38 +0000 (UTC)
commit 4382e8b876a3991e1be2827be76630e1b67b8e03
Author: Andrew Walton <awalton vmware com>
Date: Tue Nov 12 13:04:49 2013 -0800
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.
gio/gsubprocess.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/gio/gsubprocess.c b/gio/gsubprocess.c
index ca9b006..bced7a5 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]