squid/squid-3.0.STABLE13-logfile-syslog.patch

36 lines
1.1 KiB
Diff
Raw Normal View History

diff -up squid-3.0.STABLE13/src/logfile.cc.b9443 squid-3.0.STABLE13/src/logfile.cc
--- squid-3.0.STABLE13/src/logfile.cc.b9443 2009-02-03 02:36:22.000000000 +0100
+++ squid-3.0.STABLE13/src/logfile.cc 2009-03-06 15:50:43.000000000 +0100
@@ -102,21 +102,16 @@ logfileOpen(const char *path, size_t buf
if (path[6] != '\0') {
path += 7;
- char* delim = strchr(path, '.');
-
- if (!delim)
- delim = strchr(path, '|');
-
- if (delim != NULL)
- *delim = '\0';
-
- lf->syslog_priority = syslog_ntoa(path);
-
- if (delim != NULL)
- lf->syslog_priority |= syslog_ntoa(delim+1);
-
- if (0 == (lf->syslog_priority & PRIORITY_MASK))
- lf->syslog_priority |= LOG_INFO;
+ char *priority = xstrdup(path);
+ char *facility = (char *) strchr(priority, '.');
+ if (!facility)
+ facility = (char *) strchr(priority, '|');
+ if (facility) {
+ *facility++ = '\0';
+ lf->syslog_priority |= syslog_ntoa(facility);
+ }
+ lf->syslog_priority |= syslog_ntoa(priority);
+ xfree(priority);
}
} else
#endif