bug-cfengine
[Top][All Lists]
Advanced

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

Re: cfexecd chdir


From: Jason Kim
Subject: Re: cfexecd chdir
Date: Mon, 3 Oct 2005 12:29:02 -0400
User-agent: KMail/1.8.1

On Sunday 02 October 2005 22:22, Tim Nelson wrote:
> On Wed, 28 Sep 2005, Jason Kim wrote:
> > I've noticed that cfexecd stays in the directory it was started in even
> > when in daemon mode. May or may not have caused a problem I was
> > experiencing with one of my shellcommands (the directory I started it in
> > was subsequently deleted). I did a bunch of stuff at the same time, so I
> > couldn't isolate/verify the fix, but chdir'ing to '/' is probably a good
> > thing anyway. Simple patch follows.
>
>       Wouldn't we be better off with
> --------------
> struct passwd RootPassStruct;
>
> RootPassStruct =  getpwnam("root");
> chdir(RootPassStruct->pw_dir);
> --------------
>
Sorry, the list bounced me, wasn't answering from the right address. 2nd try, 
original reply below.

I suppose that works too... I thought that it was common practice to cd to
'/' for any daemon simply because it is always guaranteed to be there.  
As the problem I had (though I'm still not 100% sure) had to do with
cfexecd having a deleted directory as its cwd, I figured this would be the
best fix.
-JayKim




reply via email to

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