On 2010-09-29 10:49, Theo de Raadt wrote:
> Perhaps a posix weenie can look into making hexdump use setvbuf and
> adjusting the read requirements for fread() when the length (-n
> argument) is specified as being short of the blocksize.

How about this weenie?

Index: display.c
===================================================================
RCS file: /cvs/src/usr.bin/hexdump/display.c,v
retrieving revision 1.18
diff -u -p -r1.18 display.c
--- display.c   27 Oct 2009 23:59:39 -0000      1.18
+++ display.c   29 Sep 2010 15:03:11 -0000
@@ -300,6 +300,8 @@ next(char **argv)
                                ++_argv;
                                continue;
                        }
+                       if (length > 0 && length < BUFSIZ)
+                               setvbuf(stdin, NULL, _IONBF, 0);
                        statok = done = 1;
                } else {
                        if (done++)

-- 
NAT64/DNS64 open-source --> http://ecdysis.viagenie.ca
STUN/TURN server        --> http://numb.viagenie.ca
vCard 4.0               --> http://www.vcarddav.org

Reply via email to