1
0
Fork 0
mirror of https://github.com/otakuto/crazydiskinfo.git synced 2025-07-22 14:16:11 +00:00

Fix crash by skipping S.M.A.R.T unavailable disk

This commit is contained in:
Takanori Suzuki 2017-01-20 18:58:04 +09:00
parent 1acfbf1339
commit 1b98d35985

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)));