hexdump: always stat input when skipping
authorSascha Wildner <saw@online.de>
Mon, 10 Aug 2009 08:30:20 +0000 (10:30 +0200)
committerSascha Wildner <saw@online.de>
Mon, 10 Aug 2009 13:49:42 +0000 (15:49 +0200)
commita030f2fad7ca7b90cf61d2be5ba16149a2c13f9c
treeddc69a2b49f02a83e3db11f9c7055847f0ee302c
parentd9a28c85a7fb083dc86e910b932e4af7342f6f33
hexdump: always stat input when skipping

The previous code would not fstat(2) the input, if operating on stdin.
Still, it would use the uninitialized struct stat to decide whether to
seek in the input or not.  This could either lead to hexdump reading the
skipped input, instead of directly seeking, or, worse, trying a seek
even though this not being possible.

Fix this issue by always fstat()ing the input.

Submitted-by: corecode
usr.bin/hexdump/display.c
usr.bin/hexdump/hexdump.h