Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/syslogd PR/51234: Onno van der Linden: syslogd some...
details: https://anonhg.NetBSD.org/src/rev/205c5187b389
branches: trunk
changeset: 345861:205c5187b389
user: christos <christos%NetBSD.org@localhost>
date: Sat Jun 11 16:55:10 2016 +0000
description:
PR/51234: Onno van der Linden: syslogd sometimes incorrectly handles iso to
bsd time conversion
diffstat:
usr.sbin/syslogd/syslogd.c | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)
diffs (53 lines):
diff -r d0b73f570d84 -r 205c5187b389 usr.sbin/syslogd/syslogd.c
--- a/usr.sbin/syslogd/syslogd.c Sat Jun 11 15:17:34 2016 +0000
+++ b/usr.sbin/syslogd/syslogd.c Sat Jun 11 16:55:10 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: syslogd.c,v 1.122 2015/09/05 20:19:43 dholland Exp $ */
+/* $NetBSD: syslogd.c,v 1.123 2016/06/11 16:55:10 christos Exp $ */
/*
* Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94";
#else
-__RCSID("$NetBSD: syslogd.c,v 1.122 2015/09/05 20:19:43 dholland Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.123 2016/06/11 16:55:10 christos Exp $");
#endif
#endif /* not lint */
@@ -1745,27 +1745,28 @@
struct tm parsed;
time_t timeval;
char tsbuf[MAX_TIMESTAMPLEN];
- int i = 0;
+ int i = 0, j;
DPRINTF(D_CALL, "check_timestamp(): convert ISO->BSD\n");
for(i = 0; i < MAX_TIMESTAMPLEN && from_buf[i] != '\0'
&& from_buf[i] != '.' && from_buf[i] != ' '; i++)
tsbuf[i] = from_buf[i]; /* copy date & time */
+ j = i;
for(; i < MAX_TIMESTAMPLEN && from_buf[i] != '\0'
&& from_buf[i] != '+' && from_buf[i] != '-'
&& from_buf[i] != 'Z' && from_buf[i] != ' '; i++)
; /* skip fraction digits */
for(; i < MAX_TIMESTAMPLEN && from_buf[i] != '\0'
- && from_buf[i] != ':' && from_buf[i] != ' ' ; i++)
- tsbuf[i] = from_buf[i]; /* copy TZ */
+ && from_buf[i] != ':' && from_buf[i] != ' ' ; i++, j++)
+ tsbuf[j] = from_buf[i]; /* copy TZ */
if (from_buf[i] == ':') i++; /* skip colon */
for(; i < MAX_TIMESTAMPLEN && from_buf[i] != '\0'
- && from_buf[i] != ' ' ; i++)
- tsbuf[i] = from_buf[i]; /* copy TZ */
+ && from_buf[i] != ' ' ; i++, j++)
+ tsbuf[j] = from_buf[i]; /* copy TZ */
(void)memset(&parsed, 0, sizeof(parsed));
+ (void)strptime(tsbuf, "%FT%T%z", &parsed);
parsed.tm_isdst = -1;
- (void)strptime(tsbuf, "%FT%T%z", &parsed);
timeval = mktime(&parsed);
*to_buf = make_timestamp(&timeval, false, BSD_TIMESTAMPLEN);
Home |
Main Index |
Thread Index |
Old Index