Disk (Linux): be more careful to detect external type

This commit is contained in:
李通洲
2023-12-24 20:53:11 +08:00
parent 34b0bbac26
commit 58e8403e16
+4 -3
View File
@@ -210,10 +210,11 @@ static bool isRemovable(FFDisk* currentDisk)
if (!ffStrStartsWith(partitionName, entry->d_name)) continue;
// /sys/block/sdx/device/delete
// /sys/block/sdx/removable
ffStrbufAppendS(&basePath, entry->d_name);
ffStrbufAppendS(&basePath, "/device/delete");
return ffPathExists(basePath.chars, FF_PATHTYPE_FILE);
ffStrbufAppendS(&basePath, "/removable");
char removableChar = '0';
return ffReadFileData(basePath.chars, 1, &removableChar) > 0 && removableChar == '1';
}
return false;