When --read-bytes=N (-N N) is used, disable input buffering in
authorJim Meyering <jim@meyering.net>
Wed, 19 Sep 2001 10:19:19 +0000 (10:19 +0000)
committerJim Meyering <jim@meyering.net>
Wed, 19 Sep 2001 10:19:19 +0000 (10:19 +0000)
commit18b2abbf6c741f61f4a22c31e21462a27263b4cb
treeff3c21037f816205e6571c8d1c9a1571d85bfc51
parent7a33a0275595505d9fa8a89ec13c508a8729cae8
When --read-bytes=N (-N N) is used, disable input buffering in
the standard I/O library.  Otherwise, od would read more input
than requested.  This could have caused problems when reading
from pipes, character devices, and open file descriptors inherited
from a parent process.

* src/od.c (open_next_file): New function, factored out of...
(skip): Adapt to use open_next_file.
(read_char): Likewise.
(read_block): Likewise.
(main): Likewise.
(dump): Fix an off-by-one error that could have made od fail to
report a read error when reading from a named file (not stdin).
(check_and_close): Account for the fact that in_stream may now be NULL.
(usage): Correct descriptions of -j and -N options.
Patch by Ian Bruce.
src/od.c