fix(rfkill): handle EAGAIN correctly

This commit is contained in:
Aleksei Bavshin 2021-02-10 08:22:22 -08:00
parent 6d5afdaa5f
commit e786ea601e
No known key found for this signature in database
GPG Key ID: 4F071603387A382A

View File

@ -56,14 +56,15 @@ bool waybar::util::Rfkill::on_event(Glib::IOCondition cond) {
len = read(fd_, &event, sizeof(event)); len = read(fd_, &event, sizeof(event));
if (len < 0) { if (len < 0) {
if (errno == EAGAIN) {
return true;
}
spdlog::error("Reading of RFKILL events failed: {}", errno); spdlog::error("Reading of RFKILL events failed: {}", errno);
return false; return false;
} }
if (len < RFKILL_EVENT_SIZE_V1) { if (len < RFKILL_EVENT_SIZE_V1) {
if (errno != EAGAIN) { spdlog::error("Wrong size of RFKILL event: {} < {}", len, RFKILL_EVENT_SIZE_V1);
spdlog::error("Wrong size of RFKILL event: {}", len);
}
return true; return true;
} }