commit 393f20c

nia  ·  2019-12-11 19:00:28 +0000 UTC
parent ba4bc75
Add ftruncate fallback if posix_fallocate fails

No filesystem on NetBSD implements posix_fallocate.
1 files changed,  +1, -1
+1, -1
1@@ -177,7 +177,7 @@ context_create_buffer(struct wld_context *base,
2 
3 	unlink(name);
4 
5-	if (posix_fallocate(fd, 0, size) != 0)
6+	if (posix_fallocate(fd, 0, size) != 0 && ftruncate(fd, size) != 0)
7 		goto error2;
8 
9 	if (!(pool = wl_shm_create_pool(context->wl, fd, size)))