From e786ea601ed0aba54338bb7ea1563f2f3ebd5ae0 Mon Sep 17 00:00:00 2001 From: Aleksei Bavshin Date: Wed, 10 Feb 2021 08:22:22 -0800 Subject: [PATCH] fix(rfkill): handle EAGAIN correctly --- src/util/rfkill.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/util/rfkill.cpp b/src/util/rfkill.cpp index d3eb516a..7400135e 100644 --- a/src/util/rfkill.cpp +++ b/src/util/rfkill.cpp @@ -56,14 +56,15 @@ bool waybar::util::Rfkill::on_event(Glib::IOCondition cond) { len = read(fd_, &event, sizeof(event)); if (len < 0) { + if (errno == EAGAIN) { + return true; + } spdlog::error("Reading of RFKILL events failed: {}", errno); return false; } if (len < RFKILL_EVENT_SIZE_V1) { - if (errno != EAGAIN) { - spdlog::error("Wrong size of RFKILL event: {}", len); - } + spdlog::error("Wrong size of RFKILL event: {} < {}", len, RFKILL_EVENT_SIZE_V1); return true; }