diff options
Diffstat (limited to 'usr.bin/mkimg/image.c')
-rw-r--r-- | usr.bin/mkimg/image.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/mkimg/image.c b/usr.bin/mkimg/image.c index 3e7c7d2..be1c2e9 100644 --- a/usr.bin/mkimg/image.c +++ b/usr.bin/mkimg/image.c @@ -405,16 +405,18 @@ image_copyin_mapped(lba_t blk, int fd, uint64_t *sizep) error = 0; while (!error && cur < end) { hole = lseek(fd, cur, SEEK_HOLE); + if (hole == -1) + hole = end; data = lseek(fd, cur, SEEK_DATA); + if (data == -1) + data = end; /* * Treat the entire file as data if sparse files * are not supported by the underlying file system. */ - if (hole == -1 && data == -1) { + if (hole == end && data == end) data = cur; - hole = end; - } if (cur == hole && data > hole) { hole = pos; |