Received: from eggs.gnu.org ([140.186.70.92]:46044) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rld9D-0006K3-EB for qemu-devel@nongnu.org; Fri, 13 Jan 2012 04:10:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rld98-0002sQ-Qh for qemu-devel@nongnu.org; Fri, 13 Jan 2012 04:10:07 -0500 Received: from isrv.corpit.ru ([86.62.121.231]:42222) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rld98-0002rI-Kc for qemu-devel@nongnu.org; Fri, 13 Jan 2012 04:10:02 -0500 From: Michael Tokarev Date: Fri, 13 Jan 2012 13:04:43 +0400 Message-Id: <20120113090951.3D333341@gandalf.tls.msk.ru> Subject: [Qemu-devel] [PATCH] do not chdir(/) in qemu-nbd List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf When qemu-nbd becomes a daemon it calls daemon(3) with nochdir=0, so daemon(3) changes current directory to /. But at this time, qemu-nbd did not open any user-specified files yet, so by changing current directory, all non-absolute paths becomes wrong. The solution is to pass nochdir=1 to daemon(3) function. This patch is applicable for -stable. Signed-Off-By: Michael Tokarev --- qemu-nbd.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/qemu-nbd.c b/qemu-nbd.c index eb61c33..d84e2a7 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -429,7 +429,7 @@ int main(int argc, char **argv) pid = fork(); if (pid == 0) { close(stderr_fd[0]); - ret = qemu_daemon(0, 0); + ret = qemu_daemon(1, 0); /* Temporarily redirect stderr to the parent's pipe... */ dup2(stderr_fd[1], STDERR_FILENO); -- 1.7.2.5