Date: Tue, 4 Mar 2014 23:09:35 GMT From: Kimo R <kimor79@yahoo.com> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/187265: Passing -P to daemon(8) doesn't spawn child in an external process Message-ID: <201403042309.s24N9Z4B094692@cgiserv.freebsd.org> Resent-Message-ID: <201403042310.s24NA1p5013351@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201403042309.s24N9Z4B094692>