netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felix Janda <felix.janda@posteo.de>
To: netfilter-devel@vger.kernel.org
Subject: [ulogd2 PATCHv2] ulogd: Use /dev/null as dummy logfile when logging to syslog
Date: Sat, 16 May 2015 17:43:23 +0200	[thread overview]
Message-ID: <20150516154040.GA3782@euler> (raw)

Fixes compilation error with musl libc:

ulogd.c:86:13: error: storage size of 'syslog_dummy' isn't known
 static FILE syslog_dummy;

Signed-off-by: Felix Janda <felix.janda@posteo.de>
---
 src/ulogd.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/ulogd.c b/src/ulogd.c
index e7cde39..958c30a 100644
--- a/src/ulogd.c
+++ b/src/ulogd.c
@@ -83,7 +83,7 @@ static char *ulogd_logfile = NULL;
 static const char *ulogd_configfile = ULOGD_CONFIGFILE;
 static const char *ulogd_pidfile = NULL;
 static int ulogd_pidfile_fd = -1;
-static FILE syslog_dummy;
+static FILE *syslog_dummy;
 
 static int info_mode = 0;
 
@@ -427,7 +427,7 @@ void __ulogd_log(int level, char *file, int line, const char *format, ...)
 	if (level < loglevel_ce.u.value)
 		return;
 
-	if (logfile == &syslog_dummy) {
+	if (logfile == syslog_dummy) {
 		/* FIXME: this omits the 'file' string */
 		va_start(ap, format);
 		vsyslog(ulogd2syslog_level(level), format, ap);
@@ -950,7 +950,7 @@ static int logfile_open(const char *name)
 		logfile = stdout;
 	} else if (!strcmp(name, "syslog")) {
 		openlog("ulogd", LOG_PID, LOG_DAEMON);
-		logfile = &syslog_dummy;
+		logfile = syslog_dummy = fopen("/dev/null", "w");
 	} else {
 		logfile = fopen(ulogd_logfile, "a");
 		if (!logfile) {
@@ -1240,7 +1240,7 @@ static void sigterm_handler(int signal)
 	unload_plugins();
 #endif
 
-	if (logfile != NULL  && logfile != stdout && logfile != &syslog_dummy) {
+	if (logfile != NULL  && logfile != stdout) {
 		fclose(logfile);
 		logfile = NULL;
 	}
@@ -1262,7 +1262,7 @@ static void signal_handler(int signal)
 	switch (signal) {
 	case SIGHUP:
 		/* reopen logfile */
-		if (logfile != stdout && logfile != &syslog_dummy) {
+		if (logfile != stdout && logfile != syslog_dummy) {
 			fclose(logfile);
 			logfile = fopen(ulogd_logfile, "a");
  			if (!logfile) {
-- 
2.3.6

                 reply	other threads:[~2015-05-16 15:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150516154040.GA3782@euler \
    --to=felix.janda@posteo.de \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).