Save errno before calling pthread_mutex_lock because pthread_mutex_lock

may change errno unexpectly.
This commit is contained in:
David Xu 2006-05-11 09:10:33 +00:00
parent e92b415c5a
commit 3a31b448c0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=158426

View File

@ -153,6 +153,8 @@ vsyslog(int pri, const char *fmt, va_list ap)
pri &= LOG_PRIMASK|LOG_FACMASK; pri &= LOG_PRIMASK|LOG_FACMASK;
} }
saved_errno = errno;
THREAD_LOCK(); THREAD_LOCK();
/* Check priority against setlogmask values. */ /* Check priority against setlogmask values. */
@ -161,8 +163,6 @@ vsyslog(int pri, const char *fmt, va_list ap)
return; return;
} }
saved_errno = errno;
/* Set default facility if none specified. */ /* Set default facility if none specified. */
if ((pri & LOG_FACMASK) == 0) if ((pri & LOG_FACMASK) == 0)
pri |= LogFacility; pri |= LogFacility;