summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2016-02-08 22:09:23 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2016-02-08 22:09:23 +0000
commit06282fbb995ae080058d9256e2638368cdaebff2 (patch)
treeb6911f343fe33718b0bcd31bd1dc93f2d3b1c471
parent6eecd8319d21a5796949e5d2fd39b885cebfb749 (diff)
Fix a bug that caused nothing to be skipped when skipping exactly the
number of bytes present in a regular file was requested. Bug reported by a user called "tdm" on the comstyle #openbsd IRC channel. Patch written by Michal Mazurek <akfaew at jasminek dot net>. OK jung@ millert@ czarkoff@
-rw-r--r--usr.bin/hexdump/display.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/hexdump/display.c b/usr.bin/hexdump/display.c
index db9506765c1..2c755d61173 100644
--- a/usr.bin/hexdump/display.c
+++ b/usr.bin/hexdump/display.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: display.c,v 1.21 2015/01/16 06:40:08 deraadt Exp $ */
+/* $OpenBSD: display.c,v 1.22 2016/02/08 22:09:22 schwarze Exp $ */
/* $NetBSD: display.c,v 1.12 2001/12/07 15:14:29 bjh21 Exp $ */
/*
@@ -329,7 +329,7 @@ doskip(const char *fname, int statok)
if (fstat(fileno(stdin), &sb))
err(1, "fstat %s", fname);
if (S_ISREG(sb.st_mode)) {
- if (skip >= sb.st_size) {
+ if (skip > sb.st_size) {
address += sb.st_size;
skip -= sb.st_size;
} else {