aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt5
-rw-r--r--crypto/compat/syslog_r.c11
-rw-r--r--include/compat/syslog.h20
-rw-r--r--m4/check-libc.m42
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)
516endif() 516endif()
517 517
518check_function_exists(vsyslog HAVE_VSYSLOG)
519if(HAVE_VSYSLOG)
520 add_definitions(-DHAVE_VSYSLOG)
521endif()
522
518check_symbol_exists(timespecsub sys/time.h HAVE_TIMESPECSUB) 523check_symbol_exists(timespecsub sys/time.h HAVE_TIMESPECSUB)
519if(HAVE_TIMESPECSUB) 524if(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
3void 5void
@@ -14,6 +16,15 @@ void
14vsyslog_r(int pri, struct syslog_data *data, const char *fmt, va_list ap) 16vsyslog_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>
43void 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
55void 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])
26AC_CHECK_FUNCS([readpassphrase reallocarray recallocarray]) 26AC_CHECK_FUNCS([readpassphrase reallocarray recallocarray])
27AC_CHECK_FUNCS([strcasecmp strlcat strlcpy strndup strnlen strsep strtonum]) 27AC_CHECK_FUNCS([strcasecmp strlcat strlcpy strndup strnlen strsep strtonum])
28AC_CHECK_FUNCS([timegm _mkgmtime timespecsub]) 28AC_CHECK_FUNCS([timegm _mkgmtime timespecsub])
29AC_CHECK_FUNCS([getopt getprogname syslog syslog_r]) 29AC_CHECK_FUNCS([getopt getprogname syslog syslog_r vsyslog])
30AC_CACHE_CHECK([for getpagesize], ac_cv_func_getpagesize, [ 30AC_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>