better handling of read() interfacename
@@ -7801,14 +7801,11 @@ static char interfacepathname[PATH_MAX];
snprintf(interfacepathname, PATH_MAX -1, "/sys/class/net/%s/phy80211/name", interfacename);
fd = open(interfacepathname, O_RDONLY);
if(fd < 0) return;
-if(read(fd, phyinterfacename, PHYIFNAMESIZE) == -1)
+if(read(fd, phyinterfacename, PHYIFNAMESIZE) > 0)
{
- phyinterfacename[0] = 0;
- close(fd);
- return;
- }
pos = strchr(phyinterfacename, '\n');
if(pos) *pos = '\0';
+ }
close(fd);
return;
}
