Skip to content

Commit

Permalink
cosme
Browse files Browse the repository at this point in the history
  • Loading branch information
otakuto committed Jan 25, 2017
1 parent 2fb109d commit 3a14ff1
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions main.cpp
Expand Up @@ -397,7 +397,6 @@ 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))
Expand All @@ -407,23 +406,23 @@ int main()
std::string("ram") != std::string(e->d_name).substr(0,3) &&
std::string("loop") != std::string(e->d_name).substr(0,4))
{
SkDisk * skdisk;
SkBool b;
int f = sk_disk_open((std::string("/dev/") + std::string(e->d_name)).c_str(), &skdisk);
if (f < 0)
{
continue;
}
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)));
}
SkDisk * skdisk;
SkBool b;
int f = sk_disk_open((std::string("/dev/") + std::string(e->d_name)).c_str(), &skdisk);
if (f < 0)
{
continue;
}
int 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)));
}
}
}
std::sort(smartList.begin(), smartList.end(), [](SMART const & lhs, SMART const & rhs){return lhs.deviceName < rhs.deviceName;});
Expand Down

0 comments on commit 3a14ff1

Please sign in to comment.