Merge pull request #372 from tmm1/linux-proc-mounts

Read disk partitions on linux from /proc/mounts instead of /etc/mtab
pull/375/head
shirou 8 years ago committed by GitHub
commit fd7db8b441

@ -214,10 +214,8 @@ var fsTypeMap = map[int64]string{
// Partitions returns disk partitions. If all is false, returns
// physical devices only (e.g. hard disks, cd-rom drives, USB keys)
// and ignore all others (e.g. memory partitions such as /dev/shm)
//
// should use setmntent(3) but this implement use /etc/mtab file
func Partitions(all bool) ([]PartitionStat, error) {
filename := common.HostEtc("mtab")
filename := common.HostProc("self/mounts")
lines, err := common.ReadLines(filename)
if err != nil {
return nil, err

Loading…
Cancel
Save