From: Anatol P. <ana...@gm...> - 2013-02-12 19:12:57
|
Hi On Tue, Feb 12, 2013 at 10:50 AM, Vladimir Rutsky <rut...@gm...> wrote: > > Hello! > > When fuse-powered program is ran in foreground mode (default) it changes > current working directory to "/" (see fuse_daemonize() function in > lib/helper.c), otherwise fuse runs don't change CWD. > > I thinks this is a bug, this at least leads to different behavior if > program use relative paths. No, it is not a bug, it is done intentionally. This behavior mimics daemon() function [1] that changes workdir to "/" by default. The reason why we do this is daemon processes usually run very long time (until system shutdown). If we leave CWD of the process to directory where we run the fuse application then we will be unable to unmount this directory. BTW I found "The Linux Programming Interface" book [2] extremely valuable, in particular in contains explanation how daemon() works (pages 768-771) [1] http://www.kernel.org/doc/man-pages/online/pages/man3/daemon.3.html [2] http://www.amazon.com/Linux-Programming-Interface-System-Handbook/dp/1593272200 |