Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Jan 2023 08:58:51 GMT
From:      Eugene Grosbein <eugen@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 2ce3ef550350 - main - syslog: fix PID of forking process
Message-ID:  <202301030858.3038wpF9045327@gitrepo.freebsd.org>

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

URL: https://cgit.FreeBSD.org/src/commit/?id=2ce3ef55035093cac7839e71e9ff91f5562ebc29

commit 2ce3ef55035093cac7839e71e9ff91f5562ebc29
Author:     Eugene Grosbein <eugen@FreeBSD.org>
AuthorDate: 2023-01-03 08:53:47 +0000
Commit:     Eugene Grosbein <eugen@FreeBSD.org>
CommitDate: 2023-01-03 08:58:36 +0000

    syslog: fix PID of forking process
    
    Do not cache PID for a process that does not fabricate it,
    calls openlog() before forking and does not call exec() thereafter.
    
    PR:             268666
    Fixes:          e9ae9fa93745669b7dd0341d333257ad6cfe8e37
    Tested by:      kp
    MFC after:      3 days
---
 lib/libc/gen/syslog.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/libc/gen/syslog.c b/lib/libc/gen/syslog.c
index 2424cef78dd7..08bdfdbeb1e7 100644
--- a/lib/libc/gen/syslog.c
+++ b/lib/libc/gen/syslog.c
@@ -218,7 +218,7 @@ vsyslog1(int pri, const char *fmt, va_list ap)
 	 * specified, as it provides valuable information. Many
 	 * applications tend not to use this, even though they should.
 	 */
-	if (LogPid == -1)
+	if (LogTagLength <= 0)
 		LogPid = getpid();
 	(void)fprintf(fp, "%d ", (int)LogPid);
 	/* Message ID. */



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