diff --git a/Compat.c b/Compat.c index d0ad2cc92..6df0b081a 100644 --- a/Compat.c +++ b/Compat.c @@ -50,11 +50,11 @@ int Compat_faccessat(int dirfd, } // Fallback to stat(2)/lstat(2) depending on flags - struct stat statinfo; + struct stat sb; if (flags) { - ret = lstat(pathname, &statinfo); + ret = lstat(pathname, &sb); } else { - ret = stat(pathname, &statinfo); + ret = stat(pathname, &sb); } return ret; diff --git a/OpenFilesScreen.c b/OpenFilesScreen.c index 08b3b3d67..d04cce76e 100644 --- a/OpenFilesScreen.c +++ b/OpenFilesScreen.c @@ -238,10 +238,10 @@ static OpenFiles_ProcessData* OpenFilesScreen_getProcessData(pid_t pid) { item = &fdata->data; const char* filename = getDataForType(item, 'n'); - struct stat st; - if (stat(filename, &st) == 0) { + struct stat sb; + if (stat(filename, &sb) == 0) { char fileSizeBuf[21]; /* 20 (long long) + 1 (NULL) */ - xSnprintf(fileSizeBuf, sizeof(fileSizeBuf), "%"PRIu64, (uint64_t)st.st_size); /* st.st_size is long long on macOS, long on linux */ + xSnprintf(fileSizeBuf, sizeof(fileSizeBuf), "%"PRIu64, (uint64_t)sb.st_size); /* sb.st_size is long long on macOS, long on linux */ free_and_xStrdup(&item->data[fileSizeIndex], fileSizeBuf); } } diff --git a/linux/LinuxProcessTable.c b/linux/LinuxProcessTable.c index 1e7c041dd..f32710221 100644 --- a/linux/LinuxProcessTable.c +++ b/linux/LinuxProcessTable.c @@ -490,18 +490,18 @@ static bool LinuxProcessTable_updateUser(const Machine* host, Process* process, return true; } - struct stat sstat; + struct stat sb; #ifdef HAVE_OPENAT - int statok = fstat(procFd, &sstat); + int statok = fstat(procFd, &sb); #else - int statok = stat(procFd, &sstat); + int statok = stat(procFd, &sb); #endif if (statok == -1) return false; - if (process->st_uid != sstat.st_uid) { - process->st_uid = sstat.st_uid; - process->user = UsersTable_getRef(host->usersTable, sstat.st_uid); + if (process->st_uid != sb.st_uid) { + process->st_uid = sb.st_uid; + process->user = UsersTable_getRef(host->usersTable, sb.st_uid); } return true; @@ -1349,19 +1349,19 @@ static char* LinuxProcessTable_updateTtyDevice(TtyDriver* ttyDrivers, unsigned l continue; } unsigned int idx = min - ttyDrivers[i].minorFrom; - struct stat sstat; + struct stat sb; char* fullPath; for (;;) { xAsprintf(&fullPath, "%s/%d", ttyDrivers[i].path, idx); - int err = stat(fullPath, &sstat); - if (err == 0 && major(sstat.st_rdev) == maj && minor(sstat.st_rdev) == min) { + int err = stat(fullPath, &sb); + if (err == 0 && major(sb.st_rdev) == maj && minor(sb.st_rdev) == min) { return fullPath; } free(fullPath); xAsprintf(&fullPath, "%s%d", ttyDrivers[i].path, idx); - err = stat(fullPath, &sstat); - if (err == 0 && major(sstat.st_rdev) == maj && minor(sstat.st_rdev) == min) { + err = stat(fullPath, &sb); + if (err == 0 && major(sb.st_rdev) == maj && minor(sb.st_rdev) == min) { return fullPath; } free(fullPath); @@ -1372,8 +1372,8 @@ static char* LinuxProcessTable_updateTtyDevice(TtyDriver* ttyDrivers, unsigned l idx = min; } - int err = stat(ttyDrivers[i].path, &sstat); - if (err == 0 && tty_nr == sstat.st_rdev) { + int err = stat(ttyDrivers[i].path, &sb); + if (err == 0 && tty_nr == sb.st_rdev) { return xStrdup(ttyDrivers[i].path); } }