diff options
-rw-r--r-- | usr.bin/look/look.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/usr.bin/look/look.c b/usr.bin/look/look.c index e6fd1b8..7c590c7 100644 --- a/usr.bin/look/look.c +++ b/usr.bin/look/look.c @@ -140,6 +140,10 @@ main(int argc, char *argv[]) err(2, "%s", file); if (sb.st_size > SIZE_T_MAX) errx(2, "%s: %s", file, strerror(EFBIG)); + if (sb.st_size == 0) { + close(fd); + continue; + } if ((front = mmap(NULL, (size_t)sb.st_size, PROT_READ, MAP_SHARED, fd, (off_t)0)) == MAP_FAILED) err(2, "%s", file); back = front + sb.st_size; |