From f470196a4144dd586f8b80efeef4aca39cf11514 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sun, 27 Jan 2008 12:50:12 +0000 Subject: [PATCH] - fix conflicting decls of syslog related facilitynames and prioritynames tables --- init/init.c | 2 +- libbb/info_msg.c | 2 +- libbb/verror_msg.c | 2 +- loginutils/login.c | 2 +- loginutils/passwd.c | 1 - loginutils/sulogin.c | 3 +-- miscutils/crond.c | 2 +- miscutils/devfsd.c | 11 +++------ networking/dnsd.c | 2 +- networking/isrv_identd.c | 2 +- networking/libiproute/iprule.c | 1 - networking/telnetd.c | 3 +-- networking/zcip.c | 4 +--- sysklogd/klogd.c | 2 +- sysklogd/logger.c | 42 +++++++++++++++++++--------------- sysklogd/syslogd.c | 10 ++++---- util-linux/mount.c | 2 +- 17 files changed, 42 insertions(+), 51 deletions(-) diff --git a/init/init.c b/init/init.c index f7eb8f34b..513ff340c 100644 --- a/init/init.c +++ b/init/init.c @@ -10,9 +10,9 @@ */ #include "libbb.h" +#include #include #include -#include #define INIT_BUFFS_SIZE 256 #define CONSOLE_NAME_SIZE 32 diff --git a/libbb/info_msg.c b/libbb/info_msg.c index b0ce64338..3231bc8cf 100644 --- a/libbb/info_msg.c +++ b/libbb/info_msg.c @@ -7,8 +7,8 @@ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ -#include #include "libbb.h" +#include void bb_info_msg(const char *s, ...) { diff --git a/libbb/verror_msg.c b/libbb/verror_msg.c index dbd8323e4..ca44030b2 100644 --- a/libbb/verror_msg.c +++ b/libbb/verror_msg.c @@ -7,8 +7,8 @@ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ -#include #include "libbb.h" +#include smallint logmode = LOGMODE_STDIO; const char *msg_eol = "\n"; diff --git a/loginutils/login.c b/loginutils/login.c index 7e9044654..55cbfa7cd 100644 --- a/loginutils/login.c +++ b/loginutils/login.c @@ -4,9 +4,9 @@ */ #include "libbb.h" +#include #include #include -#include #if ENABLE_SELINUX #include /* for is_selinux_enabled() */ diff --git a/loginutils/passwd.c b/loginutils/passwd.c index 0842b71bf..0df084e5a 100644 --- a/loginutils/passwd.c +++ b/loginutils/passwd.c @@ -6,7 +6,6 @@ #include "libbb.h" #include - static void nuke_str(char *str) { if (str) memset(str, 0, strlen(str)); diff --git a/loginutils/sulogin.c b/loginutils/sulogin.c index af457ef1e..faa93eaea 100644 --- a/loginutils/sulogin.c +++ b/loginutils/sulogin.c @@ -5,9 +5,8 @@ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ -#include - #include "libbb.h" +#include //static void catchalarm(int ATTRIBUTE_UNUSED junk) //{ diff --git a/miscutils/crond.c b/miscutils/crond.c index fd20e6a57..0df143ae7 100644 --- a/miscutils/crond.c +++ b/miscutils/crond.c @@ -11,8 +11,8 @@ * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. */ -#include #include "libbb.h" +#include #ifndef CRONTABS #define CRONTABS "/var/spool/cron/crontabs" diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c index 9990142c2..52a65bc98 100644 --- a/miscutils/devfsd.c +++ b/miscutils/devfsd.c @@ -53,17 +53,12 @@ The postal address is: Richard Gooch, c/o ATNF, P. O. Box 76, Epping, N.S.W., 2121, Australia. */ - -//#include -//#include -//#include -#include -#include -#include -#include #include "libbb.h" #include "xregex.h" +#include +#include +#include /* Various defines taken from linux/major.h */ #define IDE0_MAJOR 3 diff --git a/networking/dnsd.c b/networking/dnsd.c index 8f01d5c06..19720d6bc 100644 --- a/networking/dnsd.c +++ b/networking/dnsd.c @@ -17,8 +17,8 @@ * the first porting of oao' scdns to busybox also. */ -#include #include "libbb.h" +#include //#define DEBUG 1 #define DEBUG 0 diff --git a/networking/isrv_identd.c b/networking/isrv_identd.c index a93de1244..dbdecba24 100644 --- a/networking/isrv_identd.c +++ b/networking/isrv_identd.c @@ -7,8 +7,8 @@ * Licensed under GPL version 2, see file LICENSE in this tarball for details. */ -#include #include "libbb.h" +#include #include "isrv.h" enum { TIMEOUT = 20 }; diff --git a/networking/libiproute/iprule.c b/networking/libiproute/iprule.c index 6b22061a7..3f9007ee9 100644 --- a/networking/libiproute/iprule.c +++ b/networking/libiproute/iprule.c @@ -16,7 +16,6 @@ * initially integrated into busybox by Bernhard Fischer */ -#include #include #include #include diff --git a/networking/telnetd.c b/networking/telnetd.c index 0201d2636..962e5cc7b 100644 --- a/networking/telnetd.c +++ b/networking/telnetd.c @@ -24,14 +24,13 @@ #define DEBUG 0 #include "libbb.h" +#include #if DEBUG #define TELCMDS #define TELOPTS #endif #include -#include - /* Structure that describes a session */ struct tsession { diff --git a/networking/zcip.c b/networking/zcip.c index ef9aa2186..6e1c0d148 100644 --- a/networking/zcip.c +++ b/networking/zcip.c @@ -23,9 +23,6 @@ // - avoid silent script failures, especially under load... // - link status monitoring (restart on link-up; stop on link-down) -#include -#include -#include #include #include #include @@ -34,6 +31,7 @@ #include #include "libbb.h" +#include /* We don't need more than 32 bits of the counter */ #define MONOTONIC_US() ((unsigned)monotonic_us()) 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 diff --git a/util-linux/mount.c b/util-linux/mount.c index abf5cd03f..a10d28d7c 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -20,9 +20,9 @@ #include #include "libbb.h" +#include /* Needed for nfs support only... */ -#include #include #undef TRUE #undef FALSE