Assert postts only if we really obtained a timestamp.

This commit is contained in:
rin 2022-08-06 10:22:22 +00:00
parent eb7145dc97
commit 422de7d163
1 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dmesg.c,v 1.50 2022/08/06 10:19:44 rin Exp $ */ /* $NetBSD: dmesg.c,v 1.51 2022/08/06 10:22:22 rin Exp $ */
/*- /*-
* Copyright (c) 1991, 1993 * Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved. * The Regents of the University of California. All rights reserved.
@ -38,7 +38,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993\
#if 0 #if 0
static char sccsid[] = "@(#)dmesg.c 8.1 (Berkeley) 6/5/93"; static char sccsid[] = "@(#)dmesg.c 8.1 (Berkeley) 6/5/93";
#else #else
__RCSID("$NetBSD: dmesg.c,v 1.50 2022/08/06 10:19:44 rin Exp $"); __RCSID("$NetBSD: dmesg.c,v 1.51 2022/08/06 10:22:22 rin Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -327,7 +327,6 @@ main(int argc, char *argv[])
ADDC(ch); ADDC(ch);
ADDC('\0'); ADDC('\0');
tstamp = 0; tstamp = 0;
postts = true;
sec = fsec = 0; sec = fsec = 0;
switch (sscanf(tbuf, "[%jd.%ld]", &sec, &fsec)){ switch (sscanf(tbuf, "[%jd.%ld]", &sec, &fsec)){
case 0: case 0:
@ -344,6 +343,7 @@ main(int argc, char *argv[])
/* Help */ /* Help */
continue; continue;
} }
postts = true;
for (nsec = fsec, j = 9 - scale; --j >= 0; ) for (nsec = fsec, j = 9 - scale; --j >= 0; )
nsec *= 10; nsec *= 10;