aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-02-25 18:07:23 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-02-25 18:07:23 +0000
commit3f601a31dc24d7acba7b57124e3b319b792b9581 (patch)
tree249f9640714faef0219c80f8bcaa5d40c9aa6983
parentmain: geometry defaults to 800x600 pixels (diff)
shm: handle EINTR in posix_fallocate()
-rw-r--r--shm.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/shm.c b/shm.c
index 33095e74..ab717bd0 100644
--- a/shm.c
+++ b/shm.c
@@ -2,6 +2,7 @@
#include <unistd.h>
#include <assert.h>
+#include <errno.h>
#include <sys/types.h>
#include <sys/mman.h>
@@ -124,7 +125,9 @@ shm_get_buffer(struct wl_shm *shm, int width, int height, unsigned long cookie)
size = stride * height;
LOG_DBG("cookie=%lx: allocating new buffer: %zu KB", cookie, size / 1024);
- int err = posix_fallocate(pool_fd, 0, size);
+ int err = EINTR;
+ while (err == EINTR)
+ err = posix_fallocate(pool_fd, 0, size);
if (err != 0) {
static bool failure_logged = false;