projects
/
oweals
/
netifd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
209c508
)
system-linux: check ioctl return value in system_if_flags()
author
Hans Dedecker
<dedeckeh@gmail.com>
Sat, 14 Apr 2018 19:15:42 +0000
(21:15 +0200)
committer
Hans Dedecker
<dedeckeh@gmail.com>
Sat, 14 Apr 2018 19:17:40 +0000
(21:17 +0200)
Detected by Coverity in CID
1433760
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
system-linux.c
patch
|
blob
|
history
diff --git
a/system-linux.c
b/system-linux.c
index 993320175c6c8db1ece3a049a07d6986b3a70e96..0b594f67a55f80274b7009494a9843b113a4d843 100644
(file)
--- a/
system-linux.c
+++ b/
system-linux.c
@@
-781,7
+781,9
@@
static int system_if_flags(const char *ifname, unsigned add, unsigned rem)
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
- ioctl(sock_ioctl, SIOCGIFFLAGS, &ifr);
+ if (ioctl(sock_ioctl, SIOCGIFFLAGS, &ifr) < 0)
+ return -1;
+
ifr.ifr_flags |= add;
ifr.ifr_flags &= ~rem;
return ioctl(sock_ioctl, SIOCSIFFLAGS, &ifr);