Skip to content

Commit 009ec50

Browse files
authored
Merge pull request #1291 from arstercz/master
[disk][linux] fix readlink error which system boot by nfs mount
2 parents 24a1ae5 + f6dc96c commit 009ec50

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

disk/disk_linux.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -351,10 +351,9 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro
351351
// so we get the real device name from its major/minor number
352352
if d.Device == "/dev/root" {
353353
devpath, err := os.Readlink(common.HostSys("/dev/block/" + blockDeviceID))
354-
if err != nil {
355-
return nil, err
354+
if err == nil {
355+
d.Device = strings.Replace(d.Device, "root", filepath.Base(devpath), 1)
356356
}
357-
d.Device = strings.Replace(d.Device, "root", filepath.Base(devpath), 1)
358357
}
359358
}
360359
ret = append(ret, d)

0 commit comments

Comments
 (0)