Commit 0236d278 authored by Josh Triplett's avatar Josh Triplett Committed by Craig Small

watch: Don't attempt to ungetc parts of unknown ANSI escape sequences

If process_ansi encountered an unknown character when processing an ANSI
escape sequence, it would ungetc all the characters read so far, except
for the character just read, and the opening '\033['.  ungetting the
middle of the escape sequence does not produce useful results, and also
relies on the unportable assumption that ungetc works on multiple
characters (which glibc does not support).  Discard the characters
Signed-off-by: Josh Triplett's avatarJosh Triplett <>
parent f9a4fef6
......@@ -217,8 +217,6 @@ static void process_ansi(FILE * fp)
if ((c < '0' || c > '9') && c != ';') {
while (--i >= 0)
ungetc(buf[i], fp);
buf[i] = (char)c;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment