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:
parent
1acfbf1339
commit
1b98d35985
1 changed files with 4 additions and 1 deletions
5
main.cpp
5
main.cpp
|
@ -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)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue