mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-16 04:28:05 +02:00
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.
This commit is contained in:
parent
7d622157f0
commit
01d8d43d0b
@ -1099,6 +1099,7 @@ do_exec (gint child_err_report_fd,
|
|||||||
{
|
{
|
||||||
/* Keep process from blocking on a read of stdin */
|
/* Keep process from blocking on a read of stdin */
|
||||||
gint read_null = open ("/dev/null", O_RDONLY);
|
gint read_null = open ("/dev/null", O_RDONLY);
|
||||||
|
g_assert (read_null != -1);
|
||||||
sane_dup2 (read_null, 0);
|
sane_dup2 (read_null, 0);
|
||||||
close_and_invalidate (&read_null);
|
close_and_invalidate (&read_null);
|
||||||
}
|
}
|
||||||
@ -1117,6 +1118,7 @@ do_exec (gint child_err_report_fd,
|
|||||||
else if (stdout_to_null)
|
else if (stdout_to_null)
|
||||||
{
|
{
|
||||||
gint write_null = sane_open ("/dev/null", O_WRONLY);
|
gint write_null = sane_open ("/dev/null", O_WRONLY);
|
||||||
|
g_assert (write_null != -1);
|
||||||
sane_dup2 (write_null, 1);
|
sane_dup2 (write_null, 1);
|
||||||
close_and_invalidate (&write_null);
|
close_and_invalidate (&write_null);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user