* [PATCH] rfkill: stop execution when rfkill device cannot be opened
@ 2020-10-23 20:08 Sami Kerola
0 siblings, 0 replies; only message in thread
From: Sami Kerola @ 2020-10-23 20:08 UTC (permalink / raw)
To: util-linux; +Cc: Sami Kerola
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>
---
sys-utils/rfkill.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sys-utils/rfkill.c b/sys-utils/rfkill.c
index b00bf753e..73fb4bab4 100644
--- a/sys-utils/rfkill.c
+++ b/sys-utils/rfkill.c
@@ -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);
--
2.29.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2020-10-23 20:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-23 20:08 [PATCH] rfkill: stop execution when rfkill device cannot be opened Sami Kerola
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).