>Number:         187265
>Category:       bin
>Synopsis:       Passing -P to daemon(8) doesn't spawn child in an external 
>process
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 04 23:10:01 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     Kimo R
>Release:        10.0-RELEASE
>Organization:
>Environment:
>Description:
The manpage for daemon(8) says that with the -P (write daemon's pid to a file) 
flag, the program is spawned in a child process. However, passing -P doesn't 
cause the program to actually spawn in a child process.
>How-To-Repeat:
daemon -P /tmp/foo.pid some_long_running_process
>Fix:
This patch checks if -P was given in the same place as the check for -p (and -r)

Patch attached with submission follows:

--- ./daemon.c.orig     2014-03-04 22:20:17.000000000 +0000
+++ ./daemon.c  2014-03-04 22:23:29.000000000 +0000
@@ -139,7 +139,7 @@
         * get SIGCHLD eventually.
         */
        pid = -1;
-       if (pidfile != NULL || restart) {
+       if (pidfile != NULL || ppidfile != NULL || restart) {
                /*
                 * Restore default action for SIGTERM in case the
                 * parent process decided to ignore it.


>Release-Note:
>Audit-Trail:
>Unformatted:
_______________________________________________
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to