From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KLOqQ-00046v-Ft for qemu-devel@nongnu.org; Tue, 22 Jul 2008 16:52:26 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KLOqN-000450-SI for qemu-devel@nongnu.org; Tue, 22 Jul 2008 16:52:26 -0400 Received: from [199.232.76.173] (port=41780 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KLOqN-00044r-KR for qemu-devel@nongnu.org; Tue, 22 Jul 2008 16:52:23 -0400 Received: from e2.ny.us.ibm.com ([32.97.182.142]:47242) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KLOqN-0008QV-7W for qemu-devel@nongnu.org; Tue, 22 Jul 2008 16:52:23 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e2.ny.us.ibm.com (8.13.8/8.13.8) with ESMTP id m6MKqCD7006771 for ; Tue, 22 Jul 2008 16:52:12 -0400 Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v9.0) with ESMTP id m6MKqCmu213570 for ; Tue, 22 Jul 2008 16:52:12 -0400 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m6MKqCsx001652 for ; Tue, 22 Jul 2008 16:52:12 -0400 From: Anthony Liguori Date: Tue, 22 Jul 2008 15:51:43 -0500 Message-Id: <1216759903-21779-3-git-send-email-aliguori@us.ibm.com> In-Reply-To: <1216759903-21779-1-git-send-email-aliguori@us.ibm.com> References: <1216759903-21779-1-git-send-email-aliguori@us.ibm.com> Subject: [Qemu-devel] [PATCH 3/3] Fix -daemonize option Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori 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. Signed-off-by: Anthony Liguori diff --git a/vl.c b/vl.c index f057a5e..d94ebb1 100644 --- a/vl.c +++ b/vl.c @@ -8626,11 +8626,6 @@ int main(int argc, char **argv) } #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 @@ int main(int argc, char **argv) exit(1); umask(027); - chdir("/"); signal(SIGTSTP, SIG_IGN); signal(SIGTTOU, SIG_IGN); @@ -8974,6 +8968,7 @@ int main(int argc, char **argv) if (len != 1) exit(1); + chdir("/"); TFR(fd = open("/dev/null", O_RDWR)); if (fd == -1) exit(1);