rfkill: stop execution when rfkill device cannot be opened

Without this two error messages are printed when rfkill device
cannot be opened.

    $ rfkill
    rfkill: cannot open /dev/rfkill: No such file or directory
    rfkill: cannot read /dev/rfkill: Bad file descriptor

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2020-10-23 20:39:24 +01:00
parent a371c3f71e
commit 06229abccf
No known key found for this signature in database
GPG Key ID: 0D46FEF7E61DBB46
1 changed files with 4 additions and 0 deletions

View File

@ -420,6 +420,8 @@ static int rfkill_list_old(const char *param)
}
fd = rfkill_ro_open(1);
if (fd < 0)
return -errno;
while (1) {
rc = rfkill_read_event(fd, &event);
@ -492,6 +494,8 @@ static int rfkill_list_fill(struct control const *ctrl, const char *param)
}
fd = rfkill_ro_open(1);
if (fd < 0)
return -errno;
while (1) {
rc = rfkill_read_event(fd, &event);