projects
/
project
/
netifd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1e2cf67
)
system-linux: remove unnecessary open call in system_if_dump_info()
author
Hans Dedecker
<dedeckeh@gmail.com>
Thu, 12 Apr 2018 20:36:38 +0000
(22:36 +0200)
committer
Hans Dedecker
<dedeckeh@gmail.com>
Thu, 12 Apr 2018 20:36:38 +0000
(22:36 +0200)
Detected by coverity in CID
1329735
system-linux.c
patch
|
blob
|
history
diff --git
a/system-linux.c
b/system-linux.c
index 6fb0a01bf20c9b117c729fa3a04c20b8f9cc2fef..3cdf3e44f8d1e9dd22bcb071b358ca6293fdd2c4 100644
(file)
--- a/
system-linux.c
+++ b/
system-linux.c
@@
-1708,16
+1708,12
@@
system_if_dump_info(struct device *dev, struct blob_buf *b)
{
struct ethtool_cmd ecmd;
struct ifreq ifr;
- char
buf[64],
*s;
+ char *s;
void *c;
- int dir_fd;
-
- snprintf(buf, sizeof(buf), "/sys/class/net/%s", dev->ifname);
- dir_fd = open(buf, O_DIRECTORY);
memset(&ecmd, 0, sizeof(ecmd));
memset(&ifr, 0, sizeof(ifr));
- str
cpy(ifr.ifr_name, dev->ifname
);
+ str
ncpy(ifr.ifr_name, dev->ifname, sizeof(ifr.ifr_name)
);
ifr.ifr_data = (caddr_t) &ecmd;
ecmd.cmd = ETHTOOL_GSET;
@@
-1736,7
+1732,6
@@
system_if_dump_info(struct device *dev, struct blob_buf *b)
blobmsg_add_string_buffer(b);
}
- close(dir_fd);
return 0;
}