1
0
mirror of https://github.com/shirou/gopsutil.git synced 2025-04-24 13:48:56 +08:00

[disk][linux] Follow symlinks with filepath.EvalSymlinks for LVM volumes

See #686
This commit is contained in:
Lomanic 2019-06-23 17:38:42 +02:00
parent 97328c4ed4
commit d7405fd873

View File

@ -299,11 +299,11 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro
}
if strings.HasPrefix(d.Device, "/dev/mapper/") {
devpath, err := os.Readlink(d.Device)
devpath, err := filepath.EvalSymlinks(d.Device)
if err != nil {
return nil, err
}
d.Device = "/dev/" + filepath.Base(devpath)
d.Device = devpath
}
// /dev/root is not the real device name