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:
parent
97328c4ed4
commit
d7405fd873
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user