Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/dmesg eat NUL's first so that the state machine is not ...



details:   https://anonhg.NetBSD.org/src/rev/7711f27f3af6
branches:  trunk
changeset: 831486:7711f27f3af6
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Apr 02 01:15:31 2018 +0000

description:
eat NUL's first so that the state machine is not altered by them.

diffstat:

 sbin/dmesg/dmesg.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r b981b3b7f8a7 -r 7711f27f3af6 sbin/dmesg/dmesg.c
--- a/sbin/dmesg/dmesg.c        Mon Apr 02 00:46:07 2018 +0000
+++ b/sbin/dmesg/dmesg.c        Mon Apr 02 01:15:31 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dmesg.c,v 1.29 2018/04/01 19:36:13 christos Exp $      */
+/*     $NetBSD: dmesg.c,v 1.30 2018/04/02 01:15:31 christos Exp $      */
 /*-
  * Copyright (c) 1991, 1993
  *     The Regents of the University of California.  All rights reserved.
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)dmesg.c    8.1 (Berkeley) 6/5/93";
 #else
-__RCSID("$NetBSD: dmesg.c,v 1.29 2018/04/01 19:36:13 christos Exp $");
+__RCSID("$NetBSD: dmesg.c,v 1.30 2018/04/02 01:15:31 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -187,6 +187,8 @@
 #define ADDC(c)
 #endif
                ch = *p;
+               if (ch == '\0')
+                       continue;
                /* Skip "\n<.*>" syslog sequences. */
                /* Gather timestamp sequences */
                if (newl) {
@@ -239,8 +241,6 @@
                        }
                        newl = 0;
                }
-               if (ch == '\0')
-                       continue;
                newl = ch == '\n';
                (void)vis(buf, ch, VIS_NOSLASH, 0);
 #ifndef SMALL



Home | Main Index | Thread Index | Old Index