[glib/glib-2-32] gspawn: Abort if we can't open /dev/null
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/glib-2-32] gspawn: Abort if we can't open /dev/null
- Date: Sat, 14 Jul 2012 23:21:44 +0000 (UTC)
commit fd8056b5328e3b399561d55985e27e2a0c47c656
Author: Colin Walters <walters verbum org>
Date: Thu Jun 21 15:37:39 2012 -0400
gspawn: Abort if we can't open /dev/null
This really "shouldn't happen", but if we have an assertion here, it
will help static analysis tools know we're not hitting undefined
state.
glib/gspawn.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/glib/gspawn.c b/glib/gspawn.c
index 7df271f..e0a19ae 100644
--- a/glib/gspawn.c
+++ b/glib/gspawn.c
@@ -1083,6 +1083,7 @@ do_exec (gint child_err_report_fd,
{
/* Keep process from blocking on a read of stdin */
gint read_null = open ("/dev/null", O_RDONLY);
+ g_assert (read_null != -1);
sane_dup2 (read_null, 0);
close_and_invalidate (&read_null);
}
@@ -1101,6 +1102,7 @@ do_exec (gint child_err_report_fd,
else if (stdout_to_null)
{
gint write_null = sane_open ("/dev/null", O_WRONLY);
+ g_assert (write_null != -1);
sane_dup2 (write_null, 1);
close_and_invalidate (&write_null);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]