diff options
author | joerg <joerg@FreeBSD.org> | 1995-06-24 17:07:21 +0000 |
---|---|---|
committer | joerg <joerg@FreeBSD.org> | 1995-06-24 17:07:21 +0000 |
commit | fcc88c912307ef11807db5240b0fc65613c98728 (patch) | |
tree | c51f948f7b44cb7b3969cfa88cf28ea9c3bebf04 /sbin/dump | |
parent | 8f200791c110dad1222aba8eb007acd7b0b68aaa (diff) | |
download | FreeBSD-src-fcc88c912307ef11807db5240b0fc65613c98728.zip FreeBSD-src-fcc88c912307ef11807db5240b0fc65613c98728.tar.gz |
When using dump/rdump on large filesytems (my case 3 GB), the lseek
claims multiple times to have failed. The problem is a off_t is
converted into a int and checked for a negative. A true lseek check
should be checking if the off_t is equal to -1 for failure.
(Suggested fix from PR #bin/461)
Submitted by: mark tinguely <tinguely@opus.cs.ndsu.NoDak.edu>
Diffstat (limited to 'sbin/dump')
-rw-r--r-- | sbin/dump/traverse.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sbin/dump/traverse.c b/sbin/dump/traverse.c index 29034e6..96d46cb 100644 --- a/sbin/dump/traverse.c +++ b/sbin/dump/traverse.c @@ -558,7 +558,8 @@ bread(blkno, buf, size) extern int errno; loop: - if ((int)lseek(diskfd, ((off_t)blkno << dev_bshift), 0) < 0) + if (lseek(diskfd, ((off_t)blkno << dev_bshift), 0) != + ((off_t)blkno << dev_bshift)) msg("bread: lseek fails\n"); if ((cnt = read(diskfd, buf, size)) == size) return; @@ -598,7 +599,8 @@ loop: */ bzero(buf, size); for (i = 0; i < size; i += dev_bsize, buf += dev_bsize, blkno++) { - if ((int)lseek(diskfd, ((off_t)blkno << dev_bshift), 0) < 0) + if (lseek(diskfd, ((off_t)blkno << dev_bshift), 0) != + ((off_t)blkno << dev_bshift)) msg("bread: lseek2 fails!\n"); if ((cnt = read(diskfd, buf, (int)dev_bsize)) == dev_bsize) continue; |