summaryrefslogtreecommitdiff
path: root/comm.c
diff options
context:
space:
mode:
Diffstat (limited to 'comm.c')
-rw-r--r--comm.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/comm.c b/comm.c
index 6add38a..28e0504 100644
--- a/comm.c
+++ b/comm.c
@@ -95,13 +95,17 @@ out:
return result;
}
-bool read_comm_reply(void) {
- bool result = false;
- if (read(comm[1][0], &result, sizeof(result)) != sizeof(result)) {
- swaylock_log_errno(LOG_ERROR, "Failed to read pw result");
- result = false;
+bool read_comm_reply(bool *auth_success) {
+ ssize_t n = read(comm[1][0], auth_success, sizeof(*auth_success));
+ if (n != sizeof(*auth_success)) {
+ if (n < 0) {
+ swaylock_log_errno(LOG_ERROR, "Failed to read pw result");
+ } else {
+ swaylock_log(LOG_ERROR, "Failed to read pw result: short read of %zd bytes", n);
+ }
+ return false;
}
- return result;
+ return true;
}
int get_comm_reply_fd(void) {