nspawn: try to wait for the container PID 1 to exit, before we exit

Let's make the shutdown logic synchronous, so that there's a better chance to
detach the loopback device after use.
This commit is contained in:
Lennart Poettering
2016-11-22 13:35:09 +01:00
parent b6e953f24c
commit 6a0f896b97
+6 -1
View File
@@ -4349,8 +4349,13 @@ finish:
kill(pid, SIGKILL);
/* Try to flush whatever is still queued in the pty */
if (master >= 0)
if (master >= 0) {
(void) copy_bytes(master, STDOUT_FILENO, (uint64_t) -1, false);
master = safe_close(master);
}
if (pid > 0)
(void) wait_for_terminate(pid, NULL);
loop_remove(loop_nr, &image_fd);