summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2015-09-11 16:16:26 +0200
committerTimo Teräs <timo.teras@iki.fi>2015-10-08 11:42:23 +0300
commit707b51e0c615c0cb488468e4461c778c4d113e5e (patch)
tree88ec8cd5b402bd2d1d8f311332c0aaa31e0f74cc /src
parent1bc31bdf22ac713be0523d10b4a82d4b5d9d50e4 (diff)
downloadapk-tools-707b51e0c615c0cb488468e4461c778c4d113e5e.tar.gz
apk-tools-707b51e0c615c0cb488468e4461c778c4d113e5e.tar.bz2
apk-tools-707b51e0c615c0cb488468e4461c778c4d113e5e.tar.xz
apk-tools-707b51e0c615c0cb488468e4461c778c4d113e5e.zip
io: fix posix_fallocate failure handling
We need fall back to a splice buffer if posix_fallocate call fails due to file being a device (eg tty) or a pipe. This fixes apk fetch --stdout.
Diffstat (limited to 'src')
-rw-r--r--src/io.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/io.c b/src/io.c
index a321c0c..65851be 100644
--- a/src/io.c
+++ b/src/io.c
@@ -149,7 +149,7 @@ size_t apk_istream_splice(void *stream, int fd, size_t size,
if (r == 0)
mmapbase = mmap(NULL, size, PROT_READ | PROT_WRITE,
MAP_SHARED, fd, 0);
- else if (r != ENOSYS)
+ else if (r == EBADF || r == EFBIG || r == ENOSPC || r == EIO)
return -r;
}
if (bufsz > 2*1024*1024)