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.
Regards,
Chris
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
Posted: Wed Apr 22, 2009 10:44 pm Post subject: [asterisk-dev] Shouldn't Asterisk call chdir("/") when becom
On Wed, Apr 22, 2009 at 10:33:44PM +0100, Chris Maciejewski wrote:
Quote:
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.
It originally did. But daemon(3) is now explicitly called with nochdir=1
to simplify dumping cores.
On Wed, Apr 22, 2009 at 10:33:44PM +0100, Chris Maciejewski wrote:
> 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.
It originally did. But daemon(3) is now explicitly called with nochdir=1
to simplify dumping cores.
I think the better idea is to manage core dumps location by:
At the moment a working directory is wherever Asterisk was started.
This introduces the following bug:
1. Asterisk is started with "-G asterisk -U asterisk" options in
"/root" directory owned by 'root' user with permissions: "drwx------"
2. Current working directory is set to "/root".
3. When scanning MoH files, Asterisk tries to change directory to
"current_working_dir" (res_musiconhold.c line 967) which fails because
'asterisk' user is lacking permission to do so.
Setting working directory to "/" when demonizing would prevent the above issue.
Quote:
--
Tzafrir Cohen
Regards,
Chris
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
Posted: Fri Apr 24, 2009 3:27 pm Post subject: [asterisk-dev] Shouldn't Asterisk call chdir("/") when becom
On Fri, Apr 24, 2009 at 09:11:52AM +0100, Chris Maciejewski wrote:
Quote:
Hi Tzafrir,
2009/4/23 Tzafrir Cohen <tzafrir.cohen@xorcom.com>:
> On Wed, Apr 22, 2009 at 10:33:44PM +0100, Chris Maciejewski wrote:
>
>> 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.
>
> It originally did. But daemon(3) is now explicitly called with nochdir=1
> to simplify dumping cores.
I think the better idea is to manage core dumps location by:
At the moment a working directory is wherever Asterisk was started.
This introduces the following bug:
1. Asterisk is started with "-G asterisk -U asterisk" options in
"/root" directory owned by 'root' user with permissions: "drwx------"
2. Current working directory is set to "/root".
3. When scanning MoH files, Asterisk tries to change directory to
"current_working_dir" (res_musiconhold.c line 967) which fails because
'asterisk' user is lacking permission to do so.
This is a bug, IMHO. The test there is pointless (it is duplicated
below). And I find it strange to see a process-wide chdir() . I wonder
what happes if two such "save working directory; cd somewhere; restore
working directory" routines run concurrently.
Quote:
Setting working directory to "/" when demonizing would prevent the above issue.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum