--- /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);