os: fallback for unsupported posix_fallocate
authorIhor Antonov <ihor@antonovs.family>
Sat, 18 Jan 2020 05:13:12 +0000 (21:13 -0800)
committerSimon Ser <contact@emersion.fr>
Thu, 23 Jan 2020 20:32:59 +0000 (20:32 +0000)
commit8e2199644e4fc34ebf46ea65b7598517eaa69f18
treeda60a6595452028ba59a68115d54a384e9e9bfdc
parent501cad11888a15cafb669fc0fd881da50de72cc4
os: fallback for unsupported posix_fallocate

Some filesystems do not support fallocate and return EOPNOTSUPP.

On musl-based distros libwayland-cursor exits abruptly which causes the
application to crash. Unlike glibc, musl does not provide a fallback
mechanism for handling unsupported fallocate. Instead, musl developers
argue that application should handle the case of unsupported system
call.

This commit allows falback to ftruncate in case when EOPNOTSUPP
was recieved.

Signed-off-by: Ihor Antonov <ihor@antonovs.family>
cursor/os-compatibility.c