nspawn: fix abort when we cannot execve

If execve failed, we would die in safe_close(), because master was already
closed by fdset_close_others() on line 3123. IIUC, we don't need to keep the
fd open after sending it, so let's just close it immediately.

Reproducer:
sudo build/systemd-nspawn -M rawhide fooooooo

Fixup for 3acc84ebd9.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-07-08 15:16:41 +02:00 committed by Lennart Poettering
parent 5350df966a
commit cd132992bb
1 changed files with 1 additions and 1 deletions

View File

@ -2798,7 +2798,6 @@ static int inner_child(
int master_pty_socket,
FDSet *fds) {
_cleanup_close_ int master = -1;
_cleanup_free_ char *home = NULL;
char as_uuid[37];
size_t n_env = 1;
@ -2931,6 +2930,7 @@ static int inner_child(
}
if (arg_console_mode != CONSOLE_PIPE) {
_cleanup_close_ int master = -1;
_cleanup_free_ char *console = NULL;
/* Allocate a pty and make it available as /dev/console. */