1
0
mirror of https://github.com/simh/simh.git synced 2026-01-26 20:12:23 +00:00

Compiler suggested cleanups

This commit is contained in:
Mark Pizzolato
2013-01-23 05:07:44 -08:00
parent e6e6262f45
commit e3207c2009
6 changed files with 13 additions and 15 deletions

View File

@@ -890,19 +890,18 @@ memset(list, 0, max*sizeof(*list));
#if defined(__linux__)
if (1) {
struct dirent **namelist;
int n;
struct stat st;
n = scandir("/sys/class/tty/", &namelist, NULL, NULL);
i = scandir("/sys/class/tty/", &namelist, NULL, NULL);
while (n--) {
if (strcmp(namelist[n]->d_name, ".") &&
strcmp(namelist[n]->d_name, "..")) {
while (i--) {
if (strcmp(namelist[i]->d_name, ".") &&
strcmp(namelist[i]->d_name, "..")) {
char path[1024], devicepath[1024], driverpath[1024];
sprintf (path, "/sys/class/tty/%s", namelist[n]->d_name);
sprintf (devicepath, "/sys/class/tty/%s/device", namelist[n]->d_name);
sprintf (driverpath, "/sys/class/tty/%s/device/driver", namelist[n]->d_name);
sprintf (path, "/sys/class/tty/%s", namelist[i]->d_name);
sprintf (devicepath, "/sys/class/tty/%s/device", namelist[i]->d_name);
sprintf (driverpath, "/sys/class/tty/%s/device/driver", namelist[i]->d_name);
if ((lstat(devicepath, &st) == 0) && S_ISLNK(st.st_mode)) {
char buffer[1024];
@@ -918,7 +917,7 @@ if (1) {
}
}
}
free (namelist[n]);
free (namelist[i]);
}
free (namelist);
}