diff --git a/cursor/wayland-cursor.c b/cursor/wayland-cursor.c index d40c5c8e469f46d98ac97d7f7b9e751699db7293..ca5be8ddb4b45261f8af6a9fe74e0bd68764dce3 100644 --- a/cursor/wayland-cursor.c +++ b/cursor/wayland-cursor.c @@ -83,15 +83,19 @@ err_free: static int shm_pool_resize(struct shm_pool *pool, int size) { - if (ftruncate(pool->fd, size) < 0) - return 0; - #ifdef HAVE_POSIX_FALLOCATE + /* + * Filesystems that do support fallocate will return EINVAL or + * EOPNOTSUPP. In this case we need to fall back to ftruncate + */ errno = posix_fallocate(pool->fd, 0, size); - if (errno != 0) + if (errno != 0 && errno != EINVAL && errno != EOPNOTSUPP) return 0; #endif + if (ftruncate(pool->fd, size) < 0) + return 0; + wl_shm_pool_resize(pool->pool, size); munmap(pool->data, pool->size);