summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2012-06-21 15:37:39 -0400
committerColin Walters <walters@verbum.org>2012-06-22 10:34:03 -0400
commit01d8d43d0b66f349a38075a3ebfd82fc9bed084a (patch)
tree9de95e006c5da0fc6a980031676603d947116c53
parent7d622157f055d9fb0ae3686f2b7a4fd1952af258 (diff)
downloadglib-01d8d43d0b66f349a38075a3ebfd82fc9bed084a.tar.gz
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.
-rw-r--r--glib/gspawn.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/glib/gspawn.c b/glib/gspawn.c
index bdecff20b..5d8d57b5b 100644
--- a/glib/gspawn.c
+++ b/glib/gspawn.c
@@ -1099,6 +1099,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);
}
@@ -1117,6 +1118,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);
}