mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
gspawn: add new error message for open() failures
Reporting these as dup2() failures is bogus.
This commit is contained in:
parent
34de33a9bd
commit
b251a7cd18
@ -1620,6 +1620,7 @@ enum
|
||||
{
|
||||
CHILD_CHDIR_FAILED,
|
||||
CHILD_EXEC_FAILED,
|
||||
CHILD_OPEN_FAILED,
|
||||
CHILD_DUP2_FAILED,
|
||||
CHILD_FORK_FAILED
|
||||
};
|
||||
@ -1674,7 +1675,7 @@ do_exec (gint child_err_report_fd,
|
||||
gint read_null = safe_open ("/dev/null", O_RDONLY);
|
||||
if (read_null < 0)
|
||||
write_err_and_exit (child_err_report_fd,
|
||||
CHILD_DUP2_FAILED);
|
||||
CHILD_OPEN_FAILED);
|
||||
if (safe_dup2 (read_null, 0) < 0)
|
||||
write_err_and_exit (child_err_report_fd,
|
||||
CHILD_DUP2_FAILED);
|
||||
@ -1696,7 +1697,7 @@ do_exec (gint child_err_report_fd,
|
||||
gint write_null = safe_open ("/dev/null", O_WRONLY);
|
||||
if (write_null < 0)
|
||||
write_err_and_exit (child_err_report_fd,
|
||||
CHILD_DUP2_FAILED);
|
||||
CHILD_OPEN_FAILED);
|
||||
if (safe_dup2 (write_null, 1) < 0)
|
||||
write_err_and_exit (child_err_report_fd,
|
||||
CHILD_DUP2_FAILED);
|
||||
@ -1718,7 +1719,7 @@ do_exec (gint child_err_report_fd,
|
||||
gint write_null = safe_open ("/dev/null", O_WRONLY);
|
||||
if (write_null < 0)
|
||||
write_err_and_exit (child_err_report_fd,
|
||||
CHILD_DUP2_FAILED);
|
||||
CHILD_OPEN_FAILED);
|
||||
if (safe_dup2 (write_null, 2) < 0)
|
||||
write_err_and_exit (child_err_report_fd,
|
||||
CHILD_DUP2_FAILED);
|
||||
@ -2517,7 +2518,15 @@ fork_exec (gboolean intermediate_child,
|
||||
g_strerror (buf[1]));
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case CHILD_OPEN_FAILED:
|
||||
g_set_error (error,
|
||||
G_SPAWN_ERROR,
|
||||
G_SPAWN_ERROR_FAILED,
|
||||
_("Failed to open file to remap file descriptor (%s)"),
|
||||
g_strerror (buf[1]));
|
||||
break;
|
||||
|
||||
case CHILD_DUP2_FAILED:
|
||||
g_set_error (error,
|
||||
G_SPAWN_ERROR,
|
||||
|
Loading…
Reference in New Issue
Block a user