mirror of
https://github.com/systemd/systemd.git
synced 2024-11-01 17:51:22 +03:00
execute: some extra asserts
In some cases we checked for fd validity already explicitly, let's do this for all our fds.
This commit is contained in:
parent
5073ff6bec
commit
e75a9ed176
@ -469,9 +469,13 @@ static int setup_input(
|
||||
}
|
||||
|
||||
case EXEC_INPUT_SOCKET:
|
||||
assert(socket_fd >= 0);
|
||||
|
||||
return dup2(socket_fd, STDIN_FILENO) < 0 ? -errno : STDIN_FILENO;
|
||||
|
||||
case EXEC_INPUT_NAMED_FD:
|
||||
assert(named_iofds[STDIN_FILENO] >= 0);
|
||||
|
||||
(void) fd_nonblock(named_iofds[STDIN_FILENO], false);
|
||||
return dup2(named_iofds[STDIN_FILENO], STDIN_FILENO) < 0 ? -errno : STDIN_FILENO;
|
||||
|
||||
@ -612,9 +616,12 @@ static int setup_output(
|
||||
|
||||
case EXEC_OUTPUT_SOCKET:
|
||||
assert(socket_fd >= 0);
|
||||
|
||||
return dup2(socket_fd, fileno) < 0 ? -errno : fileno;
|
||||
|
||||
case EXEC_OUTPUT_NAMED_FD:
|
||||
assert(named_iofds[fileno] >= 0);
|
||||
|
||||
(void) fd_nonblock(named_iofds[fileno], false);
|
||||
return dup2(named_iofds[fileno], fileno) < 0 ? -errno : fileno;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user