From 8bb05ac73a5b448b339ce0bc8d396c82c459b47f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 21:33:32 +0200 Subject: Merging upstream version 2.40. Signed-off-by: Daniel Baumann --- sys-utils/fallocate.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'sys-utils/fallocate.c') 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(_(""))); + fprintf(out, USAGE_ARG_SIZE(_(""))); - 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; -- cgit v1.2.3