1
0
Fork 0
mirror of https://github.com/KingDuckZ/dindexer.git synced 2025-07-03 14:14:11 +00:00

Fix DiscInfo and make it find label and uuid correctly.

It's not the mountpoint's inode that I needed, but that of the dev!
This commit is contained in:
King_DuckZ 2016-06-04 01:02:37 +02:00
parent f0e67f1c97
commit 55a61526dc

View file

@ -190,7 +190,7 @@ namespace mchlib {
for (const fs::directory_entry& itm : make_iterator_range(fs::directory_iterator(p), fs::directory_iterator())) { for (const fs::directory_entry& itm : make_iterator_range(fs::directory_iterator(p), fs::directory_iterator())) {
struct stat curr_st; struct stat curr_st;
if (stat(itm.path().c_str(), &curr_st) and inode == curr_st.st_ino) if (not stat(itm.path().c_str(), &curr_st) and inode == curr_st.st_ino)
return fs::basename(itm); return fs::basename(itm);
} }
@ -199,12 +199,12 @@ namespace mchlib {
//Get disc label by doing the equivalent of: //Get disc label by doing the equivalent of:
//find -L /dev/disk/by-label -inum $(stat -c %i /dev/sda1) -print //find -L /dev/disk/by-label -inum $(stat -c %i /dev/sda1) -print
std::string retrieve_label (const std::string& parMountpoint) { std::string retrieve_label (const std::string& parDev) {
return find_with_same_inode(parMountpoint, "/dev/disk/by-label"); return find_with_same_inode(parDev, "/dev/disk/by-label");
} }
std::string retrieve_uuid (const std::string& parMountpoint) { std::string retrieve_uuid (const std::string& parDev) {
return find_with_same_inode(parMountpoint, "/dev/disk/by-uuid"); return find_with_same_inode(parDev, "/dev/disk/by-uuid");
} }
} //unnamed namespace } //unnamed namespace
@ -228,8 +228,8 @@ namespace mchlib {
} while(input_path.atom_count() > 0); } while(input_path.atom_count() > 0);
if (mountpoint_found()) { if (mountpoint_found()) {
m_label = retrieve_label(mountpoint()); m_label = retrieve_label(m_device);
m_uuid = retrieve_uuid(mountpoint()); m_uuid = retrieve_uuid(m_device);
} }
} }