Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Mar 2023 03:01:02 GMT
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 91b921c7d468 - main - daemon: fix double init of pid variable
Message-ID:  <202303020301.322312UB033985@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=91b921c7d4684599d1d983f77dcc3df90900adc0

commit 91b921c7d4684599d1d983f77dcc3df90900adc0
Author:     Ihor Antonov <ihor@antonovs.family>
AuthorDate: 2023-03-02 03:00:42 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2023-03-02 03:00:42 +0000

    daemon: fix double init of pid variable
    
    Reviewed by:    kevans
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/669
---
 usr.sbin/daemon/daemon.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/usr.sbin/daemon/daemon.c b/usr.sbin/daemon/daemon.c
index 9477b2a415e8..4fe749d9e5fa 100644
--- a/usr.sbin/daemon/daemon.c
+++ b/usr.sbin/daemon/daemon.c
@@ -81,7 +81,7 @@ static void daemon_sleep(time_t, long);
 
 static volatile sig_atomic_t terminate = 0;
 static volatile sig_atomic_t child_gone = 0;
-static volatile sig_atomic_t pid = 0;
+static volatile sig_atomic_t pid = -1;
 static volatile sig_atomic_t do_log_reopen = 0;
 
 static const char shortopts[] = "+cfHSp:P:ru:o:s:l:t:m:R:T:h";
@@ -286,7 +286,6 @@ main(int argc, char *argv[])
 	 * readable pipe with the child for writing to a log file
 	 * and syslog.
 	 */
-	pid = -1;
 	if (pidfile || ppidfile || restart || outfd != -1 || dosyslog) {
 		struct sigaction act_term, act_chld, act_hup;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202303020301.322312UB033985>