[asterisk-bugs] [Asterisk 0010766]: Don't change dir to '/' on fork, dump the core right.

noreply at bugs.digium.com noreply at bugs.digium.com
Thu Sep 20 04:13:30 CDT 2007


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=10766 
====================================================================== 
Reported By:                xrg
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   10766
Category:                   Core-General
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
Asterisk Version:           1.4.11  
SVN Branch (only for SVN checkouts, not tarball releases): N/A  
SVN Revision (number only!):  
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             09-20-2007 04:05 CDT
Last Modified:              09-20-2007 04:13 CDT
====================================================================== 
Summary:                    Don't change dir to '/' on fork, dump the core
right.
Description: 
When asterisk forks processes, it chdirs to '/'. That means sometimes that
the core cannot be dumped, as the asterisk process is no more uid=root.


====================================================================== 

---------------------------------------------------------------------- 
 xrg - 09-20-07 04:13  
---------------------------------------------------------------------- 
Here is the required change:

diff --git a/main/asterisk.c b/main/asterisk.c
index e1fad6f..b0529f9 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -2779,7 +2779,7 @@ int main(int argc, char *argv[])
 
 #if HAVE_WORKING_FORK
 	if (ast_opt_always_fork || !ast_opt_no_fork) {
-		daemon(0, 0);
+		daemon(1, 0);
 		ast_mainpid = getpid();
 		/* Blindly re-write pid file since we are forking */
 		unlink(ast_config_AST_PID);
-- 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
09-20-07 04:13  xrg            Note Added: 0070826                          
======================================================================




More information about the asterisk-bugs mailing list