diff options
author | Harry Jeffery <harry@exec64.co.uk> | 2019-08-15 18:49:54 +0100 |
---|---|---|
committer | Harry Jeffery <harry@exec64.co.uk> | 2019-08-15 18:49:54 +0100 |
commit | c7e391d65c14c484ed4c4b34cad0fa9e3f06aa55 (patch) | |
tree | 67b2d539b2dad4449b5442d477b8ade05c442ea1 /src/x11_window.c | |
parent | aa17fbf0e8bba4bf9fa765f1225076976f8eba16 (diff) | |
download | imv-c7e391d65c14c484ed4c4b34cad0fa9e3f06aa55.tar.gz |
wl/x11: Ensure event writes are always atomic
Diffstat (limited to 'src/x11_window.c')
-rw-r--r-- | src/x11_window.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/x11_window.c b/src/x11_window.c index 7bf7d2b..1b7f724 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -2,6 +2,7 @@ #include <assert.h> #include <fcntl.h> +#include <limits.h> #include <poll.h> #include <stdlib.h> #include <string.h> @@ -44,6 +45,9 @@ static void set_nonblocking(int fd) struct imv_window *imv_window_create(int w, int h, const char *title) { + /* Ensure event writes will always be atomic */ + assert(sizeof(struct imv_event) <= PIPE_BUF); + struct imv_window *window = calloc(1, sizeof *window); window->pointer.last.x = -1; window->pointer.last.y = -1; |