summary refs log tree commit diff
path: root/misc/syslog.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-02-14 20:14:54 +0000
committerUlrich Drepper <drepper@redhat.com>1999-02-14 20:14:54 +0000
commit0543cd2694e19a95572421988cce8c6c170e2aba (patch)
treeb0b8793f4da6fbdcc24fe85d97f29ace5b4feb74 /misc/syslog.c
parent6e0d277c5ee4b443f58e2aeea305cee520e326d6 (diff)
downloadglibc-0543cd2694e19a95572421988cce8c6c170e2aba.tar.gz
glibc-0543cd2694e19a95572421988cce8c6c170e2aba.tar.xz
glibc-0543cd2694e19a95572421988cce8c6c170e2aba.zip
Update.
1999-02-13  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>

	* misc/syslog.c (vsyslog): Remember errno for %m format.  Fix
	check for priority mask.
Diffstat (limited to 'misc/syslog.c')
-rw-r--r--misc/syslog.c6
1 files changed, 5 insertions, 1 deletions
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);