qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] do not chdir(/) in qemu-nbd


From: Michael Tokarev
Subject: Re: [Qemu-devel] [PATCH] do not chdir(/) in qemu-nbd
Date: Fri, 13 Jan 2012 16:47:35 +0400
User-agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:5.0) Gecko/20110805 Icedove/5.0

On 13.01.2012 15:57, Stefan Hajnoczi wrote:
> On Fri, Jan 13, 2012 at 9:04 AM, Michael Tokarev <address@hidden> wrote:
>> 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.
> 
> It's polite to chdir("/") so that file systems can be unmounted (even
> more important when chroot was involved, but I think qemu-nbd doesn't
> do that).  Is it possible to manually do a chdir("/") later on after
> we've opened necessary files?

Yes that was something I wasn't happy about too -- lack of chdir(/) in
daemons is annoying.

But instead of adding a chdir later, I'll try to rearrange code a bit
to do all init in the parent instead.

Will send a follow-up.

Thanks,

/mjt



reply via email to

[Prev in Thread] Current Thread [Next in Thread]