diff options
author | Hans Dedecker <dedeckeh@gmail.com> | 2018-04-12 22:36:38 +0200 |
---|---|---|
committer | Hans Dedecker <dedeckeh@gmail.com> | 2018-04-12 22:36:38 +0200 |
commit | 86a0e7c5e6934206e2f5624e2f8d3c3c25bf25b4 (patch) | |
tree | 2297c5deaa1610a69138dff5c22148f61ea4a98e /system-linux.c | |
parent | 1e2cf67ef36eaaed9a7f18898066df5c2366fd0d (diff) |
system-linux: remove unnecessary open call in system_if_dump_info()
Detected by coverity in CID 1329735
Diffstat (limited to 'system-linux.c')
-rw-r--r-- | system-linux.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/system-linux.c b/system-linux.c index 6fb0a01..3cdf3e4 100644 --- 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)); - strcpy(ifr.ifr_name, dev->ifname); + strncpy(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; } |