Skip to content

Commit

Permalink
Merge pull request #1981 from Honny1/fix-deprecated-mountinfo_PidMoun…
Browse files Browse the repository at this point in the history
…tInfo

Fix deprecated use of `mountinfo.PidMountInfo` (SA1019)
  • Loading branch information
openshift-merge-bot[bot] authored Jun 20, 2024
2 parents c3d0daa + 74fc857 commit 099f93a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions pkg/mount/mountinfo_linux.go
Original file line number Diff line number Diff line change
@@ -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)
}

0 comments on commit 099f93a

Please sign in to comment.