git: 14814ff45bb4 - stable/12 - syslog: fix PID of forking process
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 06 Jan 2023 05:09:17 UTC
The branch stable/12 has been updated by eugen:
URL: https://cgit.FreeBSD.org/src/commit/?id=14814ff45bb4f8e9accd0b45cc1f3bcf4fd9d32f
commit 14814ff45bb4f8e9accd0b45cc1f3bcf4fd9d32f
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:46:33 +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 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. */