mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-12 10:22:12 +02:00
fix(DiskIO, PhysicalDisk): fix readlink
This commit is contained in:
@@ -23,8 +23,11 @@ const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options)
|
||||
char pathSysBlock[PATH_MAX];
|
||||
snprintf(pathSysBlock, PATH_MAX, "/sys/block/%s", devName);
|
||||
|
||||
char pathSysDeviceReal[PATH_MAX] = "";
|
||||
readlink(pathSysBlock, pathSysDeviceReal, sizeof(pathSysDeviceReal) - 1);
|
||||
char pathSysDeviceReal[PATH_MAX];
|
||||
ssize_t pathLength = readlink(pathSysBlock, pathSysDeviceReal, sizeof(pathSysDeviceReal) - 1);
|
||||
if (pathLength < 0)
|
||||
continue;
|
||||
pathSysDeviceReal[pathLength] = '\0';
|
||||
|
||||
if (strstr(pathSysDeviceReal, "/virtual/")) // virtual device
|
||||
continue;
|
||||
|
||||
@@ -23,8 +23,11 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
char pathSysBlock[PATH_MAX];
|
||||
snprintf(pathSysBlock, PATH_MAX, "/sys/block/%s", devName);
|
||||
|
||||
char pathSysDeviceReal[PATH_MAX] = "";
|
||||
readlink(pathSysBlock, pathSysDeviceReal, sizeof(pathSysDeviceReal) - 1);
|
||||
char pathSysDeviceReal[PATH_MAX];
|
||||
ssize_t pathLength = readlink(pathSysBlock, pathSysDeviceReal, sizeof(pathSysDeviceReal) - 1);
|
||||
if (pathLength < 0)
|
||||
continue;
|
||||
pathSysDeviceReal[pathLength] = '\0';
|
||||
|
||||
if (strstr(pathSysDeviceReal, "/virtual/")) // virtual device
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user