diff options
| author | Kartik Naik <kartik@bugqore.com> | 2026-08-19 21:56:32 +0530 |
|---|---|---|
| committer | Kartik Naik <kartik@bugqore.com> | 2026-08-19 21:56:32 +0530 |
| commit | 87c1738284ad9062cf344d038df2f3953030c1dd (patch) | |
| tree | 2b0a9b37d7361aceb407e5bc3adb0ec11e2ebd71 /include | |
| parent | 18d6ee9f4eec5a8b5e31eeaa5412d191c1afb742 (diff) | |
| download | portable-87c1738284ad9062cf344d038df2f3953030c1dd.tar.gz portable-87c1738284ad9062cf344d038df2f3953030c1dd.tar.bz2 portable-87c1738284ad9062cf344d038df2f3953030c1dd.zip | |
provide a vsyslog fallback in syslog_r instead of the header
AIX has syslog but not vsyslog; the fallback lived in syslog.h as non-static function definitions, so it multiply-defined vsyslog_r (also defined in syslog_r.c) and pulled vasprintf in without stdio.h. Detect vsyslog and, when absent, format with vasprintf and call syslog directly from the shim.
Diffstat (limited to 'include')
| -rw-r--r-- | include/compat/syslog.h | 20 |
1 files changed, 0 insertions, 20 deletions
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 */ | ||
