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.
cute-signatures
Natanael Copa 2015-09-11 16:16:26 +02:00 committed by Timo Teräs
parent 1bc31bdf22
commit 707b51e0c6
1 changed files with 1 additions and 1 deletions

View File

@ -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)