diff options
| -rw-r--r-- | CMakeLists.txt | 5 | ||||
| -rw-r--r-- | crypto/compat/syslog_r.c | 11 | ||||
| -rw-r--r-- | include/compat/syslog.h | 20 | ||||
| -rw-r--r-- | m4/check-libc.m4 | 2 |
4 files changed, 17 insertions, 21 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 18fb262..269038c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
| @@ -515,6 +515,11 @@ if(HAVE_SYSLOG) | |||
| 515 | add_definitions(-DHAVE_SYSLOG) | 515 | add_definitions(-DHAVE_SYSLOG) |
| 516 | endif() | 516 | endif() |
| 517 | 517 | ||
| 518 | check_function_exists(vsyslog HAVE_VSYSLOG) | ||
| 519 | if(HAVE_VSYSLOG) | ||
| 520 | add_definitions(-DHAVE_VSYSLOG) | ||
| 521 | endif() | ||
| 522 | |||
| 518 | check_symbol_exists(timespecsub sys/time.h HAVE_TIMESPECSUB) | 523 | check_symbol_exists(timespecsub sys/time.h HAVE_TIMESPECSUB) |
| 519 | if(HAVE_TIMESPECSUB) | 524 | if(HAVE_TIMESPECSUB) |
| 520 | add_definitions(-DHAVE_TIMESPECSUB) | 525 | add_definitions(-DHAVE_TIMESPECSUB) |
diff --git a/crypto/compat/syslog_r.c b/crypto/compat/syslog_r.c index d68169d..30841c1 100644 --- a/crypto/compat/syslog_r.c +++ b/crypto/compat/syslog_r.c | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | #include <stdio.h> | ||
| 2 | #include <stdlib.h> | ||
| 1 | #include <syslog.h> | 3 | #include <syslog.h> |
| 2 | 4 | ||
| 3 | void | 5 | void |
| @@ -14,6 +16,15 @@ void | |||
| 14 | vsyslog_r(int pri, struct syslog_data *data, const char *fmt, va_list ap) | 16 | vsyslog_r(int pri, struct syslog_data *data, const char *fmt, va_list ap) |
| 15 | { | 17 | { |
| 16 | #ifdef HAVE_SYSLOG | 18 | #ifdef HAVE_SYSLOG |
| 19 | #ifdef HAVE_VSYSLOG | ||
| 17 | vsyslog(pri, fmt, ap); | 20 | vsyslog(pri, fmt, ap); |
| 21 | #else | ||
| 22 | char *msg = NULL; | ||
| 23 | |||
| 24 | if (vasprintf(&msg, fmt, ap) == -1) | ||
| 25 | return; | ||
| 26 | syslog(pri, "%s", msg); | ||
| 27 | free(msg); | ||
| 28 | #endif | ||
| 18 | #endif | 29 | #endif |
| 19 | } | 30 | } |
diff --git a/include/compat/syslog.h b/include/compat/syslog.h index 3528eb3..c7a2608 100644 --- a/include/compat/syslog.h +++ b/include/compat/syslog.h | |||
| @@ -36,23 +36,3 @@ void vsyslog_r(int, struct syslog_data *, const char *, va_list); | |||
| 36 | #endif | 36 | #endif |
| 37 | 37 | ||
| 38 | #endif | 38 | #endif |
| 39 | |||
| 40 | #ifdef _AIX | ||
| 41 | #ifdef HAVE_SYSLOG | ||
| 42 | #include <stdlib.h> | ||
| 43 | void vsyslog(int facility_priority, const char *format, va_list arglist) { | ||
| 44 | char *msg = NULL; | ||
| 45 | vasprintf(&msg, format, arglist); | ||
| 46 | |||
| 47 | if (!msg) | ||
| 48 | return; | ||
| 49 | |||
| 50 | syslog(facility_priority, "%s", msg); | ||
| 51 | free(msg); | ||
| 52 | } | ||
| 53 | #endif /* HAVE_SYSLOG */ | ||
| 54 | |||
| 55 | void vsyslog_r(int pri, struct syslog_data *data, const char *fmt, va_list ap) { | ||
| 56 | vsyslog(pri, fmt, ap); | ||
| 57 | } | ||
| 58 | #endif /* AIX */ | ||
diff --git a/m4/check-libc.m4 b/m4/check-libc.m4 index 8ecc89a..7ac1a10 100644 --- a/m4/check-libc.m4 +++ b/m4/check-libc.m4 | |||
| @@ -26,7 +26,7 @@ AC_CHECK_FUNCS([asprintf freezero ftruncate getdelim getline memmem]) | |||
| 26 | AC_CHECK_FUNCS([readpassphrase reallocarray recallocarray]) | 26 | AC_CHECK_FUNCS([readpassphrase reallocarray recallocarray]) |
| 27 | AC_CHECK_FUNCS([strcasecmp strlcat strlcpy strndup strnlen strsep strtonum]) | 27 | AC_CHECK_FUNCS([strcasecmp strlcat strlcpy strndup strnlen strsep strtonum]) |
| 28 | AC_CHECK_FUNCS([timegm _mkgmtime timespecsub]) | 28 | AC_CHECK_FUNCS([timegm _mkgmtime timespecsub]) |
| 29 | AC_CHECK_FUNCS([getopt getprogname syslog syslog_r]) | 29 | AC_CHECK_FUNCS([getopt getprogname syslog syslog_r vsyslog]) |
| 30 | AC_CACHE_CHECK([for getpagesize], ac_cv_func_getpagesize, [ | 30 | AC_CACHE_CHECK([for getpagesize], ac_cv_func_getpagesize, [ |
| 31 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | 31 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
| 32 | #include <unistd.h> | 32 | #include <unistd.h> |
