diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2010-10-22 14:04:25 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2010-10-22 14:04:25 +0000 |
commit | 86eeb3667284a2dd284df2860798a007cae5401e (patch) | |
tree | a3b356ea2100857fcde0b5194f31951fd49c547f /usr.bin | |
parent | 6c92cdef18d066a194baf25f16e77957be350cd5 (diff) |
Move setvbuf() added in r1.19 to before the call to doskip() since
anything read from stdin in doskip() may be lost when we change the
buffering. Fixes PR 6492. OK guenther@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/hexdump/display.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.bin/hexdump/display.c b/usr.bin/hexdump/display.c index 74b72e81503..ce861b35a0f 100644 --- a/usr.bin/hexdump/display.c +++ b/usr.bin/hexdump/display.c @@ -1,4 +1,4 @@ -/* $OpenBSD: display.c,v 1.19 2010/10/12 17:23:21 millert Exp $ */ +/* $OpenBSD: display.c,v 1.20 2010/10/22 14:04:24 millert Exp $ */ /* $NetBSD: display.c,v 1.12 2001/12/07 15:14:29 bjh21 Exp $ */ /* @@ -306,15 +306,14 @@ next(char **argv) return(0); statok = 0; } + if (iobuf != NULL) + setvbuf(stdin, iobuf, _IOFBF, iobufsiz); if (skip) doskip(statok ? *_argv : "stdin", statok); if (*_argv) ++_argv; - if (!skip) { - if (iobuf != NULL) - setvbuf(stdin, iobuf, _IOFBF, iobufsiz); + if (!skip) return(1); - } } /* NOTREACHED */ } |