]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qemu-nbd: fork() can fail
authorMax Reitz <mreitz@redhat.com>
Wed, 25 Feb 2015 18:08:22 +0000 (13:08 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 18 Mar 2015 11:06:54 +0000 (12:06 +0100)
It is very unlikely, but it is possible.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <1424887718-10800-10-git-send-email-mreitz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qemu-nbd.c

index 0cb0e4e29afa04a9df9412d1cb973790ca9a93b4..0c9e807a1a95d305a6e827d90dbed5636dec0665 100644 (file)
@@ -635,7 +635,9 @@ int main(int argc, char **argv)
          * print errors and exit with the proper status code.
          */
         pid = fork();
-        if (pid == 0) {
+        if (pid < 0) {
+            err(EXIT_FAILURE, "Failed to fork");
+        } else if (pid == 0) {
             close(stderr_fd[0]);
             ret = qemu_daemon(1, 0);