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>
This commit is contained in:
joerg 1995-06-24 17:07:21 +00:00
parent 8f200791c1
commit fcc88c9123

View File

@ -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 @@ bread(blkno, buf, size)
*/
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;