mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-29 00:46:16 +01:00
gspawn: Handle error opening /dev/null
This is very unlikely to happen, but add error handling to mirror the other calls to `safe_open()`, and shut Coverity up. Coverity CID: #1430611 Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
parent
ce005e83c6
commit
f0e74a97e7
@ -1451,6 +1451,9 @@ do_exec (gint child_err_report_fd,
|
|||||||
else if (stderr_to_null)
|
else if (stderr_to_null)
|
||||||
{
|
{
|
||||||
gint write_null = safe_open ("/dev/null", O_WRONLY);
|
gint write_null = safe_open ("/dev/null", O_WRONLY);
|
||||||
|
if (write_null < 0)
|
||||||
|
write_err_and_exit (child_err_report_fd,
|
||||||
|
CHILD_DUP2_FAILED);
|
||||||
safe_dup2 (write_null, 2);
|
safe_dup2 (write_null, 2);
|
||||||
close_and_invalidate (&write_null);
|
close_and_invalidate (&write_null);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user