aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Grosbein <eugen@FreeBSD.org>2023-01-03 08:53:47 +0000
committerEugene Grosbein <eugen@FreeBSD.org>2023-01-03 08:58:36 +0000
commit2ce3ef55035093cac7839e71e9ff91f5562ebc29 (patch)
tree8ae6b94fdd8efb68993a306ebedc52586c04bced
parent17f2b12a3877f460f72123242c068881806388c2 (diff)
downloadsrc-2ce3ef55035093cac7839e71e9ff91f5562ebc29.tar.gz
src-2ce3ef55035093cac7839e71e9ff91f5562ebc29.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 MFC after: 3 days
-rw-r--r--lib/libc/gen/syslog.c2
1 files changed, 1 insertions, 1 deletions
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. */