From f470196a4144dd586f8b80efeef4aca39cf11514 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sun, 27 Jan 2008 12:50:12 +0000 Subject: - fix conflicting decls of syslog related facilitynames and prioritynames tables --- sysklogd/klogd.c | 2 +- sysklogd/logger.c | 42 +++++++++++++++++++++++------------------- sysklogd/syslogd.c | 10 ++++------ 3 files changed, 28 insertions(+), 26 deletions(-) (limited to 'sysklogd') diff --git a/sysklogd/klogd.c b/sysklogd/klogd.c index 72f3b559c..d65b6f9a0 100644 --- a/sysklogd/klogd.c +++ b/sysklogd/klogd.c @@ -18,7 +18,7 @@ */ #include "libbb.h" -#include +#include #include static void klogd_signal(int sig ATTRIBUTE_UNUSED) diff --git a/sysklogd/logger.c b/sysklogd/logger.c index 970b05dc6..090750173 100644 --- a/sysklogd/logger.c +++ b/sysklogd/logger.c @@ -8,28 +8,32 @@ */ #include "libbb.h" - -#if !defined CONFIG_SYSLOGD - -/* SYSLOG_NAMES defined to pull prioritynames[] and facilitynames[] - * from syslog.h. Grrrr - glibc puts those in _rwdata_! :( */ +#ifndef CONFIG_SYSLOGD #define SYSLOG_NAMES -#define SYSLOG_NAMES_CONST /* uclibc is saner :) */ -#include - +#define SYSLOG_NAMES_CONST +#include #else -#include -# ifndef __dietlibc__ - /* We have to do this since the header file defines static - * structures. Argh.... bad libc, bad, bad... - */ - typedef struct _code { - char *c_name; - int c_val; - } CODE; - extern CODE prioritynames[]; - extern CODE facilitynames[]; +/* brokenness alert. Everybody except dietlibc get's this wrong by neither + * providing a typedef nor an extern for facilitynames and prioritynames + * in syslog.h. + */ +# include +# ifndef __dietlibc__ +/* We have to do this since the header file does neither provide a sane type + * for this structure nor extern definitions. Argh.... bad libc, bad, bad... + */ +typedef struct _code { + char *c_name; /* FIXME: this should be const char *const c_name ! */ + int c_val; +} CODE; +# ifdef __UCLIBC__ +extern const CODE prioritynames[]; +extern const CODE facilitynames[]; +# else +extern CODE prioritynames[]; +extern CODE facilitynames[]; # endif +# endif #endif /* Decode a symbolic name to a numeric value diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index 345bf0e87..de8aa04a8 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c @@ -14,14 +14,12 @@ */ #include "libbb.h" +#define SYSLOG_NAMES +#define SYSLOG_NAMES_CONST +#include + #include #include - -/* SYSLOG_NAMES defined to pull prioritynames[] and facilitynames[] - * from syslog.h. Grrrr - glibc puts those in _rwdata_! :( */ -#define SYSLOG_NAMES -#define SYSLOG_NAMES_CONST /* uclibc is saner :) */ -#include #include #if ENABLE_FEATURE_REMOTE_LOG -- cgit v1.2.3