]> granicus.if.org Git - procps-ng/commit
watch: Don't attempt to ungetc parts of unknown ANSI escape sequences
authorJosh Triplett <josh@joshtriplett.org>
Fri, 8 Jul 2016 07:32:59 +0000 (00:32 -0700)
committerCraig Small <csmall@enc.com.au>
Sat, 9 Jul 2016 05:03:34 +0000 (15:03 +1000)
commit778dd8b3d546183b640965195804997fd2ac1a22
tree699c3fa93e9a400f247a38e1295fbaa5543dedce
parent5207a1e98acb4ca57a5b3c833a2e53b5651ad179
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
instead.

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