Provide a fallback for platforms that don't support varadic macros.

Sponsored by:	DARPA, NAI Labs


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@37 185d5e19-27fe-0310-9dcf-9bff6b9f3609
This commit is contained in:
Dag-Erling Smørgrav 2002-02-06 16:03:18 +00:00
parent c450908f60
commit d5943da7f6
1 changed files with 36 additions and 0 deletions

View File

@ -43,6 +43,8 @@
#include "openpam_impl.h"
#if defined(openpam_log)
/*
* Log a message through syslog(3)
*/
@ -79,3 +81,37 @@ _openpam_log(int level, const char *func, const char *fmt, ...)
va_end(ap);
}
#else
/*
* If openpam_log isn't defined as a macro, we're on a platform that
* doesn't support varadic macros (or it does but we aren't aware of
* it). Do the next best thing.
*/
void
openpam_log(int level, const char *fmt, ...)
{
va_list ap;
int priority;
switch (level) {
case PAM_LOG_DEBUG:
priority = LOG_DEBUG;
break;
case PAM_LOG_VERBOSE:
priority = LOG_INFO;
break;
case PAM_LOG_NOTICE:
priority = LOG_NOTICE;
break;
case PAM_LOG_ERROR:
priority = LOG_ERR;
break;
}
va_start(ap, fmt);
vsyslog(priority, fmt, ap);
va_end(ap);
}
#endif