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
77 lines
2.3 KiB
11 years ago
|
# --- 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.
|
||
|
|
||
|
--- ./src/ulogd.c.orig 2013-08-29 11:45:45.175597529 +0200
|
||
|
+++ ./src/ulogd.c 2013-08-29 11:53:51.722856392 +0200
|
||
|
@@ -78,7 +78,7 @@
|
||
|
static FILE *logfile = NULL; /* logfile pointer */
|
||
|
static char *ulogd_logfile = NULL;
|
||
|
static const char *ulogd_configfile = ULOGD_CONFIGFILE;
|
||
|
-static FILE syslog_dummy;
|
||
|
+static int use_syslog;
|
||
|
|
||
|
static int info_mode = 0;
|
||
|
|
||
|
@@ -420,7 +420,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);
|
||
|
@@ -937,11 +937,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) {
|
||
|
@@ -1070,7 +1071,7 @@
|
||
|
unload_plugins();
|
||
|
#endif
|
||
|
|
||
|
- if (logfile != NULL && logfile != stdout && logfile != &syslog_dummy) {
|
||
|
+ if (logfile != NULL && logfile != stdout) {
|
||
|
fclose(logfile);
|
||
|
logfile = NULL;
|
||
|
}
|
||
|
@@ -1090,7 +1091,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) {
|