1
0
Fork 0
mirror of https://github.com/otakuto/crazydiskinfo.git synced 2025-07-26 02:48:32 +00:00

Merge pull request #3 from BlueSkyDetector/PR-fix_crash_by_skipping_smart_unavailable_disk

Fix crash by skipping S.M.A.R.T unavailable disk
This commit is contained in:
otakuto 2017-01-21 13:55:23 +09:00 committed by GitHub
commit 202326422e

View file

@ -320,6 +320,7 @@ int main()
init_pair(8, COLOR_YELLOW, COLOR_BLACK);
int select = 0;
int smart_ret = 0;
std::vector<SMART> smartList;
auto dir = opendir("/sys/block");
while (auto e = readdir(dir))
@ -336,8 +337,10 @@ int main()
{
continue;
}
sk_disk_smart_is_available(skdisk, &b);
smart_ret = sk_disk_smart_is_available(skdisk, &b);
sk_disk_free(skdisk);
if (smart_ret < 0)
continue;
if (b)
{
smartList.push_back(SMART(std::string("/dev/") + std::string(e->d_name)));