summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/main.c b/main.c
index c0d7226..3a3a68f 100644
--- a/main.c
+++ b/main.c
@@ -1035,17 +1035,23 @@ static void display_in(int fd, short mask, void *data) {
}
static void comm_in(int fd, short mask, void *data) {
- if (read_comm_reply()) {
- // Authentication succeeded
- state.run_display = false;
+ if (mask & POLLIN) {
+ bool auth_success = false;
+ if (!read_comm_reply(&auth_success)) {
+ exit(EXIT_FAILURE);
+ }
+ if (auth_success) {
+ // Authentication succeeded
+ state.run_display = false;
+ } else {
+ state.auth_state = AUTH_STATE_INVALID;
+ schedule_auth_idle(&state);
+ ++state.failed_attempts;
+ damage_state(&state);
+ }
} else if (mask & (POLLHUP | POLLERR)) {
swaylock_log(LOG_ERROR, "Password checking subprocess crashed; exiting.");
exit(EXIT_FAILURE);
- } else {
- state.auth_state = AUTH_STATE_INVALID;
- schedule_auth_idle(&state);
- ++state.failed_attempts;
- damage_state(&state);
}
}