Fix up a few places where we ignore return values.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
#warning BLKFLSBUF not defined
#endif
#ifdef FDFLUSH
- ioctl (fd, FDFLUSH, 0); /* In case this is a floppy */
+ return ioctl(fd, FDFLUSH, 0); /* In case this is a floppy */
#elif defined(__linux__)
#warning FDFLUSH not defined
#endif
uuid_unparse(fs->super->s_uuid, uuid);
sprintf(fn, "%s/%s-icount-XXXXXX", tdb_dir, uuid);
fd = mkstemp(fn);
+ if (fd < 0)
+ return fd;
/*
* This is an overestimate of the size that we will need; the
blk64_t blk;
ssize_t actual;
errcode_t retval;
+ off_t r;
buf = malloc(fs->blocksize * BUF_BLOCKS);
if (!buf)
blk++;
left--;
cp += fs->blocksize;
- lseek(fd, fs->blocksize, SEEK_CUR);
+ r = lseek(fd, fs->blocksize, SEEK_CUR);
+ if (r < 0) {
+ retval = errno;
+ goto errout;
+ }
continue;
}
/* Find non-zero blocks */
#if HAVE_EXT2_IOCTLS
fd = open(jfile, O_RDONLY);
if (fd >= 0) {
- ioctl(fd, EXT2_IOC_SETFLAGS, &f);
+ retval = ioctl(fd, EXT2_IOC_SETFLAGS, &f);
close(fd);
+ if (retval)
+ return retval;
}
#endif
#endif
retval = ext2fs_extent_open2(fs, ino, inode, &handle);
if (retval)
return retval;
+ /*
+ * Find the extent closest to the start of the punch range. We don't
+ * check the return value because _goto() sets the current node to the
+ * next-lowest extent if 'start' is in a hole, and doesn't set a
+ * current node if there was a real error reading the extent tree.
+ * In that case, _get() will error out.
+ */
ext2fs_extent_goto(handle, start);
retval = ext2fs_extent_get(handle, EXT2_EXTENT_CURRENT, &extent);
if (retval)