summaryrefslogtreecommitdiffstats
path: root/sys-utils/fallocate.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys-utils/fallocate.c')
-rw-r--r--sys-utils/fallocate.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sys-utils/fallocate.c b/sys-utils/fallocate.c
index 307fbd8..ac7c687 100644
--- a/sys-utils/fallocate.c
+++ b/sys-utils/fallocate.c
@@ -101,12 +101,12 @@ static void __attribute__((__noreturn__)) usage(void)
fputs(_(" -v, --verbose verbose mode\n"), out);
fputs(USAGE_SEPARATOR, out);
- printf(USAGE_HELP_OPTIONS(22));
+ fprintf(out, USAGE_HELP_OPTIONS(22));
fputs(USAGE_ARGUMENTS, out);
- printf(USAGE_ARG_SIZE(_("<num>")));
+ fprintf(out, USAGE_ARG_SIZE(_("<num>")));
- printf(USAGE_MAN_TAIL("fallocate(1)"));
+ fprintf(out, USAGE_MAN_TAIL("fallocate(1)"));
exit(EXIT_SUCCESS);
}
@@ -144,8 +144,8 @@ static void xfallocate(int fd, int mode, off_t offset, off_t length)
#ifdef HAVE_POSIX_FALLOCATE
static void xposix_fallocate(int fd, off_t offset, off_t length)
{
- int error = posix_fallocate(fd, offset, length);
- if (error < 0) {
+ errno = posix_fallocate(fd, offset, length);
+ if (errno != 0) {
err(EXIT_FAILURE, _("fallocate failed"));
}
}
@@ -290,7 +290,9 @@ int main(int argc, char **argv)
int fd;
int mode = 0;
int dig = 0;
- int posix = 0;
+#ifdef HAVE_POSIX_FALLOCATE
+ int posix = 0;
+#endif
loff_t length = -2LL;
loff_t offset = 0;