Tighten disk safety checks
This commit is contained in:
@@ -135,6 +135,9 @@ func discoverDisks(root string) map[string]disk.DiskInfo {
|
||||
continue
|
||||
}
|
||||
mountPath := filepath.Join(root, entry.Name())
|
||||
if !disk.IsMountPoint(mountPath) {
|
||||
continue
|
||||
}
|
||||
info, _ := disk.Probe(mountPath)
|
||||
if info.State == disk.DiskAbsent {
|
||||
continue
|
||||
@@ -144,8 +147,10 @@ func discoverDisks(root string) map[string]disk.DiskInfo {
|
||||
|
||||
// If no child mountpoints were detected, the disk may be mounted directly at root.
|
||||
if len(disks) == 0 {
|
||||
if info, _ := disk.Probe(root); info.State != disk.DiskAbsent {
|
||||
disks[root] = info
|
||||
if disk.IsMountPoint(root) {
|
||||
if info, _ := disk.Probe(root); info.State != disk.DiskAbsent {
|
||||
disks[root] = info
|
||||
}
|
||||
}
|
||||
}
|
||||
return disks
|
||||
|
||||
Reference in New Issue
Block a user