Commit 3abd3e54 by Serge Hallyn

nbd: exit cleanly if nbd fails to attach

parent f1c26f2c
...@@ -2491,7 +2491,15 @@ static int do_attach_nbd(void *d) ...@@ -2491,7 +2491,15 @@ static int do_attach_nbd(void *d)
exit(0); exit(0);
} else if (fdsi.ssi_signo == SIGCHLD) { } else if (fdsi.ssi_signo == SIGCHLD) {
int status; int status;
while (waitpid(-1, &status, WNOHANG) > 0); /* If qemu-nbd fails, or is killed by a signal,
* then exit */
while (waitpid(-1, &status, WNOHANG) > 0) {
if ((WIFEXITED(status) && WEXITSTATUS(status) != 0) ||
WIFSIGNALED(status)) {
nbd_detach(nbd);
exit(1);
}
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment