mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-02 09:01:39 -05:00
cursor: posix_fallocate may fail with EINVAL if not supported
ZFS on FreeBSD >= 12.0 returns EINVAL, see https://svnweb.freebsd.org/changeset/base/325320 Signed-off-by: Jan Beich <jbeich@FreeBSD.org>
This commit is contained in:
parent
0fc00fff30
commit
1283d54dac
1 changed files with 3 additions and 3 deletions
|
|
@ -157,13 +157,13 @@ os_create_anonymous_file(off_t size)
|
||||||
|
|
||||||
#ifdef HAVE_POSIX_FALLOCATE
|
#ifdef HAVE_POSIX_FALLOCATE
|
||||||
/*
|
/*
|
||||||
* Filesystems that do support fallocate will return EOPNOTSUPP.
|
* Filesystems that do support fallocate will return EINVAL or
|
||||||
* In this case we need to fall back to ftruncate
|
* EOPNOTSUPP. In this case we need to fall back to ftruncate
|
||||||
*/
|
*/
|
||||||
ret = posix_fallocate(fd, 0, size);
|
ret = posix_fallocate(fd, 0, size);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
return fd;
|
return fd;
|
||||||
} else if (ret != EOPNOTSUPP) {
|
} else if (ret != EINVAL && ret != EOPNOTSUPP) {
|
||||||
close(fd);
|
close(fd);
|
||||||
errno = ret;
|
errno = ret;
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue