Fix deprecated use of mountinfo.PidMountInfo (SA1019)
Signed-off-by: Jan Rodák <hony.com@seznam.cz>
This commit is contained in:
parent
c3d0daacc9
commit
74fc85700a
|
|
@ -1,5 +1,18 @@
|
|||
package mount
|
||||
|
||||
import "github.com/moby/sys/mountinfo"
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
var PidMountInfo = mountinfo.PidMountInfo
|
||||
"github.com/moby/sys/mountinfo"
|
||||
)
|
||||
|
||||
func PidMountInfo(pid int) ([]*Info, error) {
|
||||
f, err := os.Open(fmt.Sprintf("/proc/%d/mountinfo", pid))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
return mountinfo.GetMountsFromReader(f, nil)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue