commit 393f20c758e3829b70a748765b72f1c95f3c506f
parent ba4bc7598d7492b8b3c011caf83e5decb71b04eb
Author: nia <nia@netbsd.org>
Date: Wed, 11 Dec 2019 19:00:28 +0000
Add ftruncate fallback if posix_fallocate fails
No filesystem on NetBSD implements posix_fallocate.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/wayland-shm.c b/wayland-shm.c
@@ -177,7 +177,7 @@ context_create_buffer(struct wld_context *base,
unlink(name);
- if (posix_fallocate(fd, 0, size) != 0)
+ if (posix_fallocate(fd, 0, size) != 0 && ftruncate(fd, size) != 0)
goto error2;
if (!(pool = wl_shm_create_pool(context->wl, fd, size)))