[glib] gtester: Use FD_CLOEXEC when creating pipes
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gtester: Use FD_CLOEXEC when creating pipes
- Date: Wed, 23 Jan 2013 17:24:19 +0000 (UTC)
commit d8874e58a78889815f004f62681cd99b5f5d36f7
Author: Colin Walters <walters verbum org>
Date: Wed Jan 23 11:51:48 2013 -0500
gtester: Use FD_CLOEXEC when creating pipes
We were already unsetting the cloexec flag for the child later,
just not actually starting with it.
https://bugzilla.gnome.org/show_bug.cgi?id=692404
glib/gtester.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/glib/gtester.c b/glib/gtester.c
index 4edcf2d..0a2feb2 100644
--- a/glib/gtester.c
+++ b/glib/gtester.c
@@ -20,6 +20,7 @@
#include "config.h"
#include <glib.h>
+#include <glib-unix.h>
#include <gstdio.h>
#include <string.h>
#include <stdlib.h>
@@ -285,12 +286,13 @@ launch_test_binary (const char *binary,
gboolean loop_pending;
gint i = 0;
- if (pipe (report_pipe) < 0)
+ if (!g_unix_open_pipe (report_pipe, FD_CLOEXEC, &error))
{
if (subtest_mode_fatal)
- g_error ("Failed to open pipe for test binary: %s: %s", binary, g_strerror (errno));
+ g_error ("Failed to open pipe for test binary: %s: %s", binary, error->message);
else
- g_warning ("Failed to open pipe for test binary: %s: %s", binary, g_strerror (errno));
+ g_warning ("Failed to open pipe for test binary: %s: %s", binary, error->message);
+ g_clear_error (&error);
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]