]> granicus.if.org Git - procps-ng/commitdiff
watch: Fix ANSI escape sequence termination
authorJosh Triplett <josh@joshtriplett.org>
Fri, 8 Jul 2016 07:29:59 +0000 (00:29 -0700)
committerCraig Small <csmall@enc.com.au>
Sat, 9 Jul 2016 05:03:18 +0000 (15:03 +1000)
process_ansi stopped processing an ANSI escape sequence if
(c < '0' && c > '9' && c != ';'), which will never happen.  Fix the
range check to use || instead.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
watch.c

diff --git a/watch.c b/watch.c
index 17608b5cb938531275a5c9997035e160a17f5031..c20780891741f53fccf586ca3890f20cd175c6c1 100644 (file)
--- a/watch.c
+++ b/watch.c
@@ -216,7 +216,7 @@ static void process_ansi(FILE * fp)
                        buf[i] = '\0';
                        break;
                }
-               if (c < '0' && c > '9' && c != ';') {
+               if ((c < '0' || c > '9') && c != ';') {
                        while (--i >= 0)
                                ungetc(buf[i], fp);
                        return;