X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fnetifd.git;a=blobdiff_plain;f=system-linux.c;fp=system-linux.c;h=3cdf3e44f8d1e9dd22bcb071b358ca6293fdd2c4;hp=6fb0a01bf20c9b117c729fa3a04c20b8f9cc2fef;hb=86a0e7c5e6934206e2f5624e2f8d3c3c25bf25b4;hpb=1e2cf67ef36eaaed9a7f18898066df5c2366fd0d 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; }