From 3a31b448c000f0f6eb840010b4287565221d94a7 Mon Sep 17 00:00:00 2001 From: David Xu Date: Thu, 11 May 2006 09:10:33 +0000 Subject: [PATCH] Save errno before calling pthread_mutex_lock because pthread_mutex_lock may change errno unexpectly. --- lib/libc/gen/syslog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/gen/syslog.c b/lib/libc/gen/syslog.c index 44efdaca99d7..e58e6956e15d 100644 --- a/lib/libc/gen/syslog.c +++ b/lib/libc/gen/syslog.c @@ -153,6 +153,8 @@ vsyslog(int pri, const char *fmt, va_list ap) pri &= LOG_PRIMASK|LOG_FACMASK; } + saved_errno = errno; + THREAD_LOCK(); /* Check priority against setlogmask values. */ @@ -161,8 +163,6 @@ vsyslog(int pri, const char *fmt, va_list ap) return; } - saved_errno = errno; - /* Set default facility if none specified. */ if ((pri & LOG_FACMASK) == 0) pri |= LogFacility;