diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 19:33:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 19:33:34 +0000 |
commit | 1272be04be0cb803eec87f602edb2e3e6f111aea (patch) | |
tree | bce17f6478cdd9f3c4ec3d751135dc42786d6a56 /sys-utils/fallocate.c | |
parent | Releasing progress-linux version 2.39.3-11~progress7.99u1. (diff) | |
download | util-linux-1272be04be0cb803eec87f602edb2e3e6f111aea.tar.xz util-linux-1272be04be0cb803eec87f602edb2e3e6f111aea.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.c | 14 |
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; |