summaryrefslogtreecommitdiff
path: root/src/od.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/od.c')
-rw-r--r--src/od.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/od.c b/src/od.c
index 0abce599a..8a07418d0 100644
--- a/src/od.c
+++ b/src/od.c
@@ -1035,9 +1035,11 @@ skip (uintmax_t n_skip)
/* The st_size field is valid only for regular files
(and for symbolic links, which cannot occur here).
If the number of bytes left to skip is larger than
- the size of the current file, we can decrement
- n_skip and go on to the next file. */
- if (S_ISREG (file_stats.st_mode) && 0 <= file_stats.st_size)
+ the size of the current file, we can decrement n_skip
+ and go on to the next file. Skip this optimization also
+ when st_size is 0, because some kernels report that
+ nonempty files in /proc have st_size == 0. */
+ if (S_ISREG (file_stats.st_mode) && 0 < file_stats.st_size)
{
if ((uintmax_t) file_stats.st_size < n_skip)
n_skip -= file_stats.st_size;