From owner-freebsd-bugs@FreeBSD.ORG Sun Jun 22 02:30:04 2008 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89156106567D for ; Sun, 22 Jun 2008 02:30:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 88A868FC17 for ; Sun, 22 Jun 2008 02:30:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m5M2U4ku099558 for ; Sun, 22 Jun 2008 02:30:04 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m5M2U4vs099555; Sun, 22 Jun 2008 02:30:04 GMT (envelope-from gnats) Date: Sun, 22 Jun 2008 02:30:04 GMT Message-Id: <200806220230.m5M2U4vs099555@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Toby Peterson Cc: Subject: Re: bin/86485: [PATCH] hexdump(1): hexdump -s speedup on /dev X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Toby Peterson List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jun 2008 02:30:04 -0000 The following reply was made to PR bin/86485; it has been noted by GNATS. From: Toby Peterson To: Garrett Cooper Cc: bug-followup@FreeBSD.org Subject: Re: bin/86485: [PATCH] hexdump(1): hexdump -s speedup on /dev Date: Sat, 21 Jun 2008 19:05:21 -0700 --Apple-Mail-7--430079199 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit On Jun 21, 2008, at 1:47 PM, Garrett Cooper wrote: > Hi, > Could you please resubmit the patch (link is broken)? > Thanks, > -Garrett That webserver is long defunct, but the attached patch should resolve the issue. - Toby --Apple-Mail-7--430079199 Content-Disposition: attachment; filename=hexdump-fseeko.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="hexdump-fseeko.diff" Content-Transfer-Encoding: 7bit ? hexdump ? hexdump.1.gz ? od.1.gz Index: Makefile =================================================================== RCS file: /home/ncvs/src/usr.bin/hexdump/Makefile,v retrieving revision 1.9 diff -u -r1.9 Makefile --- Makefile 22 Jul 2004 13:14:42 -0000 1.9 +++ Makefile 22 Jun 2008 02:01:24 -0000 @@ -7,6 +7,6 @@ MLINKS= hexdump.1 hd.1 LINKS= ${BINDIR}/hexdump ${BINDIR}/od LINKS+= ${BINDIR}/hexdump ${BINDIR}/hd -WARNS?= 6 +WARNS?= 1 .include Index: display.c =================================================================== RCS file: /home/ncvs/src/usr.bin/hexdump/display.c,v retrieving revision 1.22 diff -u -r1.22 display.c --- display.c 4 Aug 2004 02:47:32 -0000 1.22 +++ display.c 22 Jun 2008 02:01:24 -0000 @@ -44,6 +44,7 @@ #include #include +#include #include #include #include @@ -384,12 +385,13 @@ return; } } - if (S_ISREG(sb.st_mode)) { - if (fseeko(stdin, skip, SEEK_SET)) - err(1, "%s", fname); + /* try to seek first; fall back on ESPIPE */ + if (fseeko(stdin, skip, SEEK_SET) == 0) { address += skip; skip = 0; } else { + if (errno != ESPIPE) + err(1, "%s", fname); for (cnt = 0; cnt < skip; ++cnt) if (getchar() == EOF) break; --Apple-Mail-7--430079199 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit --Apple-Mail-7--430079199--