You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
2.3 KiB

# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../ulogd2/0001-replace-syslog_dummy.patch
# Copyright (C) 2013 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- SDE-COPYRIGHT-NOTE-END ---
Do not use the FILE struct as marker to check if the user requested to use
syslog.
In musl the FILE struct is opaque, thus its storage size is not known to
the application.
This means that when using musl it has to be use as a pointer like it was
intended to be used.
--- a/src/ulogd.c 2013-11-18 23:34:03.060775245 +0100
+++ b/src/ulogd.c 2013-12-15 14:04:09.354676690 +0100
@@ -83,7 +83,7 @@
static const char *ulogd_configfile = ULOGD_CONFIGFILE;
static const char *ulogd_pidfile = NULL;
static int ulogd_pidfile_fd = -1;
-static FILE syslog_dummy;
+static int use_syslog;
static int info_mode = 0;
@@ -427,7 +427,7 @@
if (level < loglevel_ce.u.value)
return;
- if (logfile == &syslog_dummy) {
+ if (use_syslog) {
/* FIXME: this omits the 'file' string */
va_start(ap, format);
vsyslog(ulogd2syslog_level(level), format, ap);
@@ -946,11 +946,12 @@
ulogd_logfile = strdup(name);
}
+ use_syslog = 0;
if (!strcmp(name, "stdout")) {
logfile = stdout;
} else if (!strcmp(name, "syslog")) {
openlog("ulogd", LOG_PID, LOG_DAEMON);
- logfile = &syslog_dummy;
+ use_syslog = 1;
} else {
logfile = fopen(ulogd_logfile, "a");
if (!logfile) {
@@ -1240,7 +1241,7 @@
unload_plugins();
#endif
- if (logfile != NULL && logfile != stdout && logfile != &syslog_dummy) {
+ if (logfile != NULL && logfile != stdout) {
fclose(logfile);
logfile = NULL;
}
@@ -1262,7 +1263,7 @@
switch (signal) {
case SIGHUP:
/* reopen logfile */
- if (logfile != stdout && logfile != &syslog_dummy) {
+ if (logfile != stdout && !use_syslog) {
fclose(logfile);
logfile = fopen(ulogd_logfile, "a");
if (!logfile) {