Merge pull request #1291 from arstercz/master

[disk][linux] fix readlink error which system boot by nfs mount
pull/1301/head
shirou 3 years ago committed by GitHub
commit 009ec50f74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -351,12 +351,11 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro
// so we get the real device name from its major/minor number // so we get the real device name from its major/minor number
if d.Device == "/dev/root" { if d.Device == "/dev/root" {
devpath, err := os.Readlink(common.HostSys("/dev/block/" + blockDeviceID)) devpath, err := os.Readlink(common.HostSys("/dev/block/" + blockDeviceID))
if err != nil { if err == nil {
return nil, err
}
d.Device = strings.Replace(d.Device, "root", filepath.Base(devpath), 1) d.Device = strings.Replace(d.Device, "root", filepath.Base(devpath), 1)
} }
} }
}
ret = append(ret, d) ret = append(ret, d)
} }

Loading…
Cancel
Save