- ftruncate(fd, (off_t)0);
- ftruncate(fd, (off_t)100000);
- fstat(fd, &statbuf);
+ /* should not ignore ftruncate(2)'s return value */
+ if (ftruncate(fd, (off_t)0) < 0) {
+ prterr("trunc_hack: ftruncate(0)");
+ exit(1);
+ }
+ if (ftruncate(fd, (off_t)100000) < 0) {
+ prterr("trunc_hack: ftruncate(100000)");
+ exit(1);
+ }
+ if (fstat(fd, &statbuf)) {
+ prterr("trunc_hack: fstat");
+ statbuf.st_size = -1;
+ }