]> git.ipfire.org Git - thirdparty/coreutils.git/commit
tail: don't call fstat on an uninitialized FD
authorJim Meyering <meyering@redhat.com>
Fri, 11 Dec 2009 11:15:13 +0000 (12:15 +0100)
committerJim Meyering <meyering@redhat.com>
Fri, 11 Dec 2009 11:15:13 +0000 (12:15 +0100)
commitfc4d3f63b0c64992014b035e8b780eb230e0c855
treebcc8b7437eae0cbcfdaf0a63a85513637eedb5bf
parent3df2108b0d8fee99a3d7344db13fc3200da08f07
tail: don't call fstat on an uninitialized FD

This bug showed up via valgrind as a "Conditional jump or move
depends on uninitialized value(s)" error.
* src/tail.c (ignore_fifo_and_pipe): New function.
(main): Use it only when tailing forever.
The code to compute n_viable and mark some F[i] as ignored would call
isapipe on an uninitialized file descriptor.  But n_viable and those
.ignored marks are useful/used only when tailing forever.  This bug
was introduced via commit f0ff8c73 (7.6), "tail: make the new
piped-stdin test as portable as the old one".
* NEWS (Bug fixes): Mention it.
NEWS
src/tail.c