rfkill: do not ignore read error
Read error should be impossible, but when one does happen user certainly wants to know about that rather than see even more strange issue caused random data in name variable. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
b03378e793
commit
6955a1d66c
|
@ -132,7 +132,11 @@ static const char *get_name(uint32_t idx)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
read(fd, name, sizeof(name) - 1);
|
||||
if (read(fd, name, sizeof(name) - 1) < 0) {
|
||||
warn(_("cannot read %s"), filename);
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pos = strchr(name, '\n');
|
||||
if (pos)
|
||||
|
|
Loading…
Reference in New Issue