toolchain: bump Codescape IMG MIPS version to 2016.05-06
[buildroot-gz.git] / package / ulogd / 0001-ulogd-Use-dev-null-as-dummy-logfile-when-logging-to-.patch
blobc7b284a0af4ffd1f885c3fb81aba0d49578f845f
1 From 8a6ddd1cb2b55c234f1a97f7e5d996f24f46b6f8 Mon Sep 17 00:00:00 2001
2 From: Felix Janda <felix.janda@posteo.de>
3 Date: Sat, 16 May 2015 17:43:23 +0200
4 Subject: [PATCH] ulogd: Use /dev/null as dummy logfile when logging to
5 syslog
7 Fixes compilation error with musl libc:
9 ulogd.c:86:13: error: storage size of 'syslog_dummy' isn't known
10 static FILE syslog_dummy;
12 Signed-off-by: Felix Janda <felix.janda@posteo.de>
13 [Rahul Bedarkar: Backported from https://git.netfilter.org/ulogd2/commit/?id=8a6ddd1cb2b55c234f1a97f7e5d996f24f46b6f8]
14 Signed-off-by: Rahul Bedarkar <rahul.bedarkar@imgtec.com>
15 ---
16 src/ulogd.c | 10 +++++-----
17 1 file changed, 5 insertions(+), 5 deletions(-)
19 diff --git a/src/ulogd.c b/src/ulogd.c
20 index e7cde39..958c30a 100644
21 --- a/src/ulogd.c
22 +++ b/src/ulogd.c
23 @@ -83,7 +83,7 @@ static char *ulogd_logfile = NULL;
24 static const char *ulogd_configfile = ULOGD_CONFIGFILE;
25 static const char *ulogd_pidfile = NULL;
26 static int ulogd_pidfile_fd = -1;
27 -static FILE syslog_dummy;
28 +static FILE *syslog_dummy;
30 static int info_mode = 0;
32 @@ -427,7 +427,7 @@ void __ulogd_log(int level, char *file, int line, const char *format, ...)
33 if (level < loglevel_ce.u.value)
34 return;
36 - if (logfile == &syslog_dummy) {
37 + if (logfile == syslog_dummy) {
38 /* FIXME: this omits the 'file' string */
39 va_start(ap, format);
40 vsyslog(ulogd2syslog_level(level), format, ap);
41 @@ -950,7 +950,7 @@ static int logfile_open(const char *name)
42 logfile = stdout;
43 } else if (!strcmp(name, "syslog")) {
44 openlog("ulogd", LOG_PID, LOG_DAEMON);
45 - logfile = &syslog_dummy;
46 + logfile = syslog_dummy = fopen("/dev/null", "w");
47 } else {
48 logfile = fopen(ulogd_logfile, "a");
49 if (!logfile) {
50 @@ -1240,7 +1240,7 @@ static void sigterm_handler(int signal)
51 unload_plugins();
52 #endif
54 - if (logfile != NULL && logfile != stdout && logfile != &syslog_dummy) {
55 + if (logfile != NULL && logfile != stdout) {
56 fclose(logfile);
57 logfile = NULL;
59 @@ -1262,7 +1262,7 @@ static void signal_handler(int signal)
60 switch (signal) {
61 case SIGHUP:
62 /* reopen logfile */
63 - if (logfile != stdout && logfile != &syslog_dummy) {
64 + if (logfile != stdout && logfile != syslog_dummy) {
65 fclose(logfile);
66 logfile = fopen(ulogd_logfile, "a");
67 if (!logfile) {
68 --
69 2.6.2