diff options
author | Jose M. Guisado <jguisado@soleta.eu> | 2022-09-27 17:56:19 +0200 |
---|---|---|
committer | Jose M. Guisado <jguisado@soleta.eu> | 2022-09-27 17:56:19 +0200 |
commit | 67d9fde94c88d188b5873d9eab0cadcb2cc2e35c (patch) | |
tree | 22eecf8718754e1d0954181d255b843708cbebdd /src | |
parent | 9bfb511749f4d8488ca6673514a1cccd9a62ce79 (diff) |
replace posix_fallocate with fallocate
posix_fallocate does not return -1 for an error case.
Replace posix_fallocate for fallocate which does return -1 when
something goes wrong. See fallocate(2):
On success, fallocate() returns zero.
On error, -1 is returned and errno is set to indicate the error.
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -7,6 +7,7 @@ * (at your option) any later version. */ +#define _GNU_SOURCE #include <stdlib.h> #include <stdio.h> #include <ev.h> @@ -273,7 +274,7 @@ static int tip_client_head_hdr(struct tip_client *cli) return -1; } - if (posix_fallocate(cli->fd, 0, cli->content_len) < 0) { + if (fallocate(cli->fd, 0, 0, cli->content_len) < 0) { syslog(LOG_ERR, "failed to allocate room for file %s: %s", filename, strerror(errno)); return -1; |