Skip to content

Commit

Permalink
fix(rfkill): handle EAGAIN correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
alebastr committed Feb 10, 2021
1 parent 6d5afda commit e786ea6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/util/rfkill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit e786ea6

Please sign in to comment.