diff options
author | Eugene Grosbein <eugen@FreeBSD.org> | 2023-01-03 08:53:47 +0000 |
---|---|---|
committer | Eugene Grosbein <eugen@FreeBSD.org> | 2023-01-06 04:46:33 +0000 |
commit | 14814ff45bb4f8e9accd0b45cc1f3bcf4fd9d32f (patch) | |
tree | ae51ccef116fa9387bc96d152e8ef177d7dfebcb | |
parent | 8c7c23a6e030e02c785d3053b57d654987b5a431 (diff) | |
download | src-14814ff45bb4f8e9accd0b45cc1f3bcf4fd9d32f.tar.gz src-14814ff45bb4f8e9accd0b45cc1f3bcf4fd9d32f.zip |
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
(cherry picked from commit 2ce3ef55035093cac7839e71e9ff91f5562ebc29)
-rw-r--r-- | lib/libc/gen/syslog.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/gen/syslog.c b/lib/libc/gen/syslog.c index 41b243627a17..3bed67c0c0d9 100644 --- a/lib/libc/gen/syslog.c +++ b/lib/libc/gen/syslog.c @@ -220,7 +220,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. */ |