From 0543cd2694e19a95572421988cce8c6c170e2aba Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 14 Feb 1999 20:14:54 +0000 Subject: Update. 1999-02-13 Andreas Schwab * misc/syslog.c (vsyslog): Remember errno for %m format. Fix check for priority mask. --- misc/syslog.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'misc/syslog.c') diff --git a/misc/syslog.c b/misc/syslog.c index a2becb43e7..daa8b77efa 100644 --- a/misc/syslog.c +++ b/misc/syslog.c @@ -123,6 +123,7 @@ vsyslog(pri, fmt, ap) struct sigaction action, oldaction; struct sigaction *oldaction_ptr = NULL; int sigpipe; + int saved_errno = errno; #define INTERNALLOG LOG_ERR|LOG_CONS|LOG_PERROR|LOG_PID /* Check for invalid bits. */ @@ -133,7 +134,7 @@ vsyslog(pri, fmt, ap) } /* Check priority against setlogmask values. */ - if (!LOG_MASK(LOG_PRI(pri)) & LogMask) + if ((LOG_MASK (LOG_PRI (pri)) & LogMask) == 0) return; /* Set default facility if none specified. */ @@ -163,6 +164,9 @@ vsyslog(pri, fmt, ap) if (LogTag != NULL) putc_unlocked (':', f), putc_unlocked (' ', f); + /* Restore errno for %m format. */ + __set_errno (saved_errno); + /* We have the header. Print the user's format into the buffer. */ vfprintf (f, fmt, ap); -- cgit v1.2.3