#518 OpenSIPS daemonizes even though -D is specified

1.7.x
closed-fixed
core (110)
5
2012-05-03
2012-05-02
Anonymous
No

When I start OpenSIPS 1.7.2 in the command-line and specify the -D parameter, it detaches from the console anyway. There seems to be a bug somewhere, since I've inserted a printf() in main.c, in the call to daemonize() and it is indeed called, even though I specified -D. So it seems like dont_fork is not properly set or it is corrupted:

if (!dont_fork){
fprintf(stderr, "daemonizing!\n"); /* debug, inserted by me */
if ( daemonize((log_name==0)?argv[0]:log_name, &own_pgid) <0 )
goto error;
}

Invoking it like this:

/usr/sbin/opensips -f /usr/local/etc/opensips/opensips.cfg -P /usr/local/var/run/opensips.pid -D

I get:

Listening on
udp: 192.168.1.3 [192.168.1.3]:5060
udp: 10.0.0.2 [10.0.0.2]:5060
Aliases:
udp: myboxip:5060
udp: myserver:5060

daemonizing!

Discussion

  • Vladut-Stefan Paiu

    Hi,

    It seems that in your config file you are specifying 'fork=yes' , so the dont_fork variable is being overwritten when the cfg is parsed.

    I have committed a fix for this in the 1.7, 1.8 and trunk branches.

    Regards,
    Vlad

     
  • Vladut-Stefan Paiu

    • assigned_to: nobody --> vladut-paiu
    • status: open --> closed-fixed
     

Log in to post a comment.