aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qemu-nbd.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/qemu-nbd.c b/qemu-nbd.c
index 0af97ca2c7..9101487128 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -345,8 +345,12 @@ int main(int argc, char **argv)
pid_t pid;
int sock;
- if (!verbose)
- daemon(0, 0); /* detach client and server */
+ if (!verbose) {
+ /* detach client and server */
+ if (daemon(0, 0) == -1) {
+ errx(errno, "Failed to daemonize");
+ }
+ }
if (socket == NULL) {
sprintf(sockpath, SOCKET_PATH, basename(device));