Re: [PATCH] daemonize & change user fixes
Alexander Malysh <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
Kalle Marjola wrote:
> On Tue, 2004-11-02 at 02:48, Alexander Malysh wrote:
>> Hi,
>>
>> attached patch fixes daemonize mode (make sure stdin/stdout/sdterr are
>> opened and do chdir("/")) and change user code (set supplementary group
>> id's and don't destroy passwd struct).
>>
> +1 for all except that '/' -thing:
> -----
> /* XXX chdir breaks restart of boxes when
> started w/o a full path to binary */
> - /* chdir("/"); */
> + chdir("/");
> -----
> Seems like there was reason not to do it. I do not say that
> this isn't right thing to do, but then if parachute is used,
> then Kannel should make sure that the path is full, not
> relative - can it like test, in daemon mode, that it can find
> itself before starting up?
reason not to do so, was my lazines while debugging this stuff ;)
the problem is, that if kannel starts in daemon mode then _all_ paths
(binary/config/config includes/etc) _must_ be absolute. We can easy check
for binary path and config path within utils.c context, but can't check
e.g. config includes because the whole idea of parachute/daemon is, to be
transparent to all kannel binaries.
We must call chdir("/") because e.g. if kannel starts w/o changing CWD and
this directory is a mounted one, then admin can't unmount this volume w/o
stopping kannel.
>
>> This patch should go into 1.4.0 stable.
>
> Yes except notes above.
>
Thanks for comments ;)
--
Thanks,
Alex