git: 77c0992af4e3 - stable/13 - syslog: fix PID of forking process
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 06 Jan 2023 04:41:17 UTC
The branch stable/13 has been updated by eugen:
URL: https://cgit.FreeBSD.org/src/commit/?id=77c0992af4e3b013915ae84ef3d831f470ea5dd5
commit 77c0992af4e3b013915ae84ef3d831f470ea5dd5
Author: Eugene Grosbein <eugen@FreeBSD.org>
AuthorDate: 2023-01-03 08:53:47 +0000
Commit: Eugene Grosbein <eugen@FreeBSD.org>
CommitDate: 2023-01-06 04:40:42 +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
(cherry picked from commit 2ce3ef55035093cac7839e71e9ff91f5562ebc29)
---
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 fe3a2c902015..1209c5b88b82 100644
--- a/lib/libc/gen/syslog.c
+++ b/lib/libc/gen/syslog.c
@@ -223,7 +223,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. */