blob: 86f5b75eeb96540542103d24caa184aaa6617f13 [file] [log] [blame]
diff -aruN a/sysklogd/syslogd.c b/sysklogd/syslogd.c
--- a/sysklogd/syslogd.c 2017-03-07 13:38:44.406178588 -0800
+++ b/sysklogd/syslogd.c 2017-03-07 13:34:40.891055910 -0800
@@ -665,33 +665,12 @@
/* Jan 18 00:11:22 msg... */
/* 01234567890123456 */
- if (len < 16 || msg[3] != ' ' || msg[6] != ' '
+ if (!(len < 16 || msg[3] != ' ' || msg[6] != ' '
|| msg[9] != ':' || msg[12] != ':' || msg[15] != ' '
- ) {
- tmp = generate_time(&tvnow, &tmnow);
- } else {
- struct tm local;
- tvnow.tv_sec = time(NULL);
- localtime_r(&tvnow.tv_sec, &local);
- if (strptime(msg, "%h %e %T", &parsed) != NULL) {
-
- parsed.tm_gmtoff = local.tm_gmtoff;
- parsed.tm_zone = local.tm_zone;
- parsed.tm_year = local.tm_year;
- parsed.tm_isdst = local.tm_isdst;
- tvnow.tv_sec = mktime(&parsed);
- tvnow.tv_usec = 0;
-
- if (option_mask32 & OPT_utc) {
- tmp = gmtime_r(&tvnow.tv_sec, &tmnow);
- } else {
- tmp = &parsed;
- }
- } else {
- tmp = generate_time(&tvnow, &tmnow);
- }
+ )) {
msg += 16;
}
+ tmp = generate_time(&tvnow, &tmnow);
n = strftime(timestamp, sizeof(timestamp), "%F %T", tmp);
snprintf(timestamp + n, sizeof(timestamp) - n, ".%06ld", tvnow.tv_usec);