Skip to contentSkip to conversation

[4924] Fix -daemonize option

Qemu-devel Anthony Liguori 1 participant 1 message Jul 23, 2008

lore
Share & tools
lore
#0 lore raw

Revision: 4924

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4924
Author:   aliguori
Date:     2008-07-23 00:58:33 +0000 (Wed, 23 Jul 2008)

Log Message:
-----------
Fix -daemonize option

When using -daemonize, we want to avoid chdir() until after we've opened the block devices. It's also perfectly fine to use -dameonize along with SDL.

Modified Paths:
--------------
trunk/vl.c

Modified: trunk/vl.c
===================================================================

vl.c +1 -6
@@ -8626,11 +8626,6 @@
     }
 
 #ifndef _WIN32
-    if (daemonize && !nographic && vnc_display == NULL) {
-	fprintf(stderr, "Can only daemonize if using -nographic or -vnc\n");
-	daemonize = 0;
-    }
-
     if (daemonize) {
 	pid_t pid;
 
@@ -8668,7 +8663,6 @@
 	    exit(1);
 
 	umask(027);
-	chdir("/");
 
         signal(SIGTSTP, SIG_IGN);
         signal(SIGTTOU, SIG_IGN);
@@ -8974,6 +8968,7 @@
 	if (len != 1)
 	    exit(1);
 
+	chdir("/");
 	TFR(fd = open("/dev/null", O_RDWR));
 	if (fd == -1)
 	    exit(1);