FreeBSD Bugzilla – Attachment 215026 Details for
Bug 246845
LOG_PID is now default but cannot be disabled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
enable LOG_PID by default but allow LOG_PID to be disabled.
logger.patch (text/plain), 1.75 KB, created by
P Kern
on 2020-05-29 15:18:29 UTC
(
hide
)
Description:
enable LOG_PID by default but allow LOG_PID to be disabled.
Filename:
MIME Type:
Creator:
P Kern
Created:
2020-05-29 15:18:29 UTC
Size:
1.75 KB
patch
obsolete
>--- /usr/src/lib/libc/gen/syslog.c 2020/05/29 02:51:45 1.1 >+++ /usr/src/lib/libc/gen/syslog.c 2020/05/29 03:34:37 >@@ -201,15 +201,18 @@ > } > /* > * Application name, process ID, message ID and structured data. >- * Provide the process ID regardless of whether LOG_PID has been >- * specified, as it provides valuable information. Many >- * applications tend not to use this, even though they should. > */ >+ > if (LogTag == NULL) > LogTag = _getprogname(); >- (void)fprintf(fp, "%s %d - - ", >- LogTag == NULL ? "-" : LogTag, getpid()); > >+ (void)fprintf(fp, "%s ", LogTag == NULL ? "-" : LogTag); >+ >+ if (LogStat & LOG_PID) >+ (void)fprintf(fp, "%d - - ", getpid()); >+ else >+ (void)fprintf(fp, "- - - "); >+ > /* Check to see if we can skip expanding the %m */ > if (strstr(fmt, "%m")) { > >@@ -437,7 +440,17 @@ > { > if (ident != NULL) > LogTag = ident; >- LogStat = logstat; >+ >+ /* >+ * Include the process ID by default: it provides valuable >+ * information. Many applications tend not to use this, even >+ * though they should. >+ * Disable LOG_PID only if it is specifically masked. >+ */ >+ LogStat = logstat | LOG_PID; >+ if (logstat != 0 && (logstat &~ LOG_PID) == ~LOG_PID) >+ LogStat = 0; >+ > if (logfac != 0 && (logfac &~ LOG_FACMASK) == 0) > LogFacility = logfac; > >--- /usr/src/usr.bin/logger/logger.c 2020/05/28 22:17:28 1.1 >+++ /usr/src/usr.bin/logger/logger.c 2020/05/29 04:07:28 >@@ -171,8 +171,15 @@ > if (tag == NULL) > tag = getlogin(); > /* setup for logging */ >- if (host == NULL) >+ if (host == NULL) { >+ /* >+ * LOG_PID is default for syslog(3) as of r332100. >+ * To disable LOG_PID, set flags to its mask. >+ */ >+ if (( logflags & LOG_PID ) != LOG_PID) >+ logflags = ~logflags; > openlog(tag, logflags, 0); >+ } > (void) fclose(stdout); > > (void )time(&now);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 246845
: 215026