aboutsummaryrefslogtreecommitdiffstats
path: root/swaylock/main.c
diff options
context:
space:
mode:
authorLibravatar Ian Fan <ianfan0@gmail.com>2018-10-23 11:46:51 +0100
committerLibravatar Ian Fan <ianfan0@gmail.com>2018-10-23 11:49:33 +0100
commitebfb1388e2b178ecee1c1e1f4b5160af0efe2db6 (patch)
treef6242e2d098774e20618542bfeff411d0a75d79b /swaylock/main.c
parentswaylock: exit early if unable to inhibit input (diff)
downloadsway-ebfb1388e2b178ecee1c1e1f4b5160af0efe2db6.tar.gz
sway-ebfb1388e2b178ecee1c1e1f4b5160af0efe2db6.tar.zst
sway-ebfb1388e2b178ecee1c1e1f4b5160af0efe2db6.zip
swaylock: exit on display error
Diffstat (limited to 'swaylock/main.c')
-rw-r--r--swaylock/main.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/swaylock/main.c b/swaylock/main.c
index 8ed8adf5..ebc2b263 100644
--- a/swaylock/main.c
+++ b/swaylock/main.c
@@ -2,6 +2,7 @@
2#define _POSIX_C_SOURCE 200112L 2#define _POSIX_C_SOURCE 200112L
3#include <assert.h> 3#include <assert.h>
4#include <ctype.h> 4#include <ctype.h>
5#include <errno.h>
5#include <fcntl.h> 6#include <fcntl.h>
6#include <getopt.h> 7#include <getopt.h>
7#include <stdbool.h> 8#include <stdbool.h>
@@ -841,7 +842,9 @@ static int load_config(char *path, struct swaylock_state *state,
841static struct swaylock_state state; 842static struct swaylock_state state;
842 843
843static void display_in(int fd, short mask, void *data) { 844static void display_in(int fd, short mask, void *data) {
844 wl_display_dispatch(state.display); 845 if (wl_display_dispatch(state.display) == -1) {
846 state.run_display = false;
847 }
845} 848}
846 849
847int main(int argc, char **argv) { 850int main(int argc, char **argv) {
@@ -961,7 +964,10 @@ int main(int argc, char **argv) {
961 964
962 state.run_display = true; 965 state.run_display = true;
963 while (state.run_display) { 966 while (state.run_display) {
964 wl_display_flush(state.display); 967 errno = 0;
968 if (wl_display_flush(state.display) == -1 && errno != EAGAIN) {
969 break;
970 }
965 loop_poll(state.eventloop); 971 loop_poll(state.eventloop);
966 } 972 }
967 973