summaryrefslogtreecommitdiffstats
path: root/sys-utils/fallocate.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:33:32 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:33:32 +0000
commit8bb05ac73a5b448b339ce0bc8d396c82c459b47f (patch)
tree1fdda006866bca20d41cb206767ea5241e36852f /sys-utils/fallocate.c
parentAdding debian version 2.39.3-11. (diff)
downloadutil-linux-8bb05ac73a5b448b339ce0bc8d396c82c459b47f.tar.xz
util-linux-8bb05ac73a5b448b339ce0bc8d396c82c459b47f.zip
Merging upstream version 2.40.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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;