fsrprintf(_("could not trunc tmp %s\n"),
tname);
}
- lseek64(tfd, outmap[extent].bmv_length, SEEK_CUR);
+ if (lseek64(tfd, outmap[extent].bmv_length, SEEK_CUR) < 0) {
+ fsrprintf(_("could not lseek in tmpfile: %s : %s\n"),
+ tname, strerror(errno));
+ goto out;
+ }
continue;
} else if (outmap[extent].bmv_length == 0) {
/* to catch holes at the beginning of the file */
" %s\n"), tname);
goto out;
}
- lseek64(tfd, outmap[extent].bmv_length, SEEK_CUR);
+ if (lseek64(tfd, outmap[extent].bmv_length, SEEK_CUR) < 0) {
+ fsrprintf(_("could not lseek in tmpfile: %s : %s\n"),
+ tname, strerror(errno));
+ goto out;
+ }
}
} /* end of space allocation loop */
for (extent = 0; extent < nextents; extent++) {
pos = outmap[extent].bmv_offset;
if (outmap[extent].bmv_block == -1) {
- lseek64(tfd, outmap[extent].bmv_length, SEEK_CUR);
- lseek64(fd, outmap[extent].bmv_length, SEEK_CUR);
+ if (lseek64(tfd, outmap[extent].bmv_length, SEEK_CUR) < 0) {
+ fsrprintf(_("could not lseek in tmpfile: %s : %s\n"),
+ tname, strerror(errno));
+ goto out;
+ }
+ if (lseek64(fd, outmap[extent].bmv_length, SEEK_CUR) < 0) {
+ fsrprintf(_("could not lseek in file: %s : %s\n"),
+ fname, strerror(errno));
+ goto out;
+ }
continue;
} else if (outmap[extent].bmv_length == 0) {
/* to catch holes at the beginning of the file */
}
}
}
- ftruncate64(tfd, statp->bs_size);
- fsync(tfd);
+ if (ftruncate64(tfd, statp->bs_size) < 0) {
+ fsrprintf(_("could not truncate tmpfile: %s : %s\n"),
+ fname, strerror(errno));
+ goto out;
+ }
+ if (fsync(tfd) < 0) {
+ fsrprintf(_("could not fsync tmpfile: %s : %s\n"),
+ fname, strerror(errno));
+ goto out;
+ }
sx.sx_stat = *statp; /* struct copy */
sx.sx_version = XFS_SX_VERSION;