return COPY_FD_OK;
}
+/* Report an lseek failure at OFFSET compared to WHENCE, for FILENAME. */
+static void
+elseek_diagnostic (off_t offset, int whence, char const *filename)
+{
+ intmax_t off = offset;
+ error (0, errno,
+ _(whence == SEEK_SET
+ ? N_("%s: cannot seek to offset %jd")
+ : N_("%s: cannot seek to relative offset %jd")),
+ quotef (filename), off);
+}
+
/* Call lseek (FD, OFFSET, WHENCE), where file descriptor FD
corresponds to the file FILENAME. WHENCE must be SEEK_SET or
SEEK_CUR. Return the resulting offset. Give a diagnostic and
off_t new_offset = lseek (fd, offset, whence);
if (new_offset < 0)
- error (0, errno,
- _(whence == SEEK_SET
- ? N_("%s: cannot seek to offset %jd")
- : N_("%s: cannot seek to relative offset %jd")),
- quotef (filename),
- (intmax_t) offset);
+ elseek_diagnostic (offset, whence, filename);
return new_offset;
}
{
struct stat st;
if (fstat (fd, &st) != 0 || S_ISREG (st.st_mode))
- elseek (fd, -n_bytes_past_EOL, SEEK_CUR, filename);
+ elseek_diagnostic (-n_bytes_past_EOL, SEEK_CUR, filename);
}
break;
}