[glib] gfile: Ensure we create internal pipe with FD_CLOEXEC
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gfile: Ensure we create internal pipe with FD_CLOEXEC
- Date: Fri, 25 Jan 2013 18:45:28 +0000 (UTC)
commit 48fd50701229de084947ea94406c1ff2c7c397f5
Author: Colin Walters <walters verbum org>
Date: Fri Jan 25 12:32:39 2013 -0500
gfile: Ensure we create internal pipe with FD_CLOEXEC
That way the descriptors aren't leaked to child processes.
https://bugzilla.gnome.org/show_bug.cgi?id=692544
gio/gfile.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/gio/gfile.c b/gio/gfile.c
index e2f0d43..21c9f59 100644
--- a/gio/gfile.c
+++ b/gio/gfile.c
@@ -46,6 +46,9 @@
#endif
#include "gfile.h"
+#ifdef G_OS_UNIX
+#include "glib-unix.h"
+#endif
#include "gvfs.h"
#include "gtask.h"
#include "gfileattribute-priv.h"
@@ -2850,12 +2853,8 @@ splice_stream_with_progress (GInputStream *in,
fd_in = g_file_descriptor_based_get_fd (G_FILE_DESCRIPTOR_BASED (in));
fd_out = g_file_descriptor_based_get_fd (G_FILE_DESCRIPTOR_BASED (out));
- if (pipe (buffer) != 0)
- {
- g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
- "Pipe creation failed");
- return FALSE;
- }
+ if (!g_unix_open_pipe (buffer, FD_CLOEXEC, error))
+ return FALSE;
total_size = -1;
/* avoid performance impact of querying total size when it's not needed */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]