[asterisk-dev] Shouldn't Asterisk call chdir("/") when becoming a daemon?
Michiel van Baak
michiel at vanbaak.info
Wed Apr 22 17:30:27 CDT 2009
On 22:33, Wed 22 Apr 09, Chris Maciejewski wrote:
> Hi,
>
> Running in the asterisk source directory:
>
> $ find . -name "*.c" -exec grep -Hn 'chdir(' {} \;
>
> only produces:
>
> ./res/res_musiconhold.c:495: if (strcasecmp(class->dir, "nodir") &&
> chdir(class->dir) < 0) {
> ./res/res_musiconhold.c:496: ast_log(LOG_WARNING, "chdir() failed:
> %s\n", strerror(errno));
> ./res/res_musiconhold.c:917: if (chdir(class->dir) < 0) {
> ./res/res_musiconhold.c:918: ast_log(LOG_WARNING, "chdir() failed:
> %s\n", strerror(errno));
> ./res/res_musiconhold.c:957: if (chdir(path) < 0) {
> ./res/res_musiconhold.c:958: ast_log(LOG_WARNING, "chdir() failed:
> %s\n", strerror(errno));
>
> so looks like asterisk is not calling chdir("/") anywhere, apart from
> res/res_musiconhold.c .
> AFAIK it is a recommended for all linux daemon processes to call
> chdir("/") when forking.
We've had this patch in the OpenBSD port for years.
Removing it did not change anything, so we also removed this patch from
our port.
Can you tell us what problem this fixes ?
We did not see any difference with or without this patch.
--
Michiel van Baak
michiel at vanbaak.eu
http://michiel.vanbaak.eu
GnuPG key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x71C946BD
"Why is it drug addicts and computer aficionados are both called users?"
More information about the asterisk-dev
mailing list