summaryrefslogtreecommitdiff
path: root/vendor/github.com/moby/sys/mountinfo/mountinfo.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-09-21 12:10:18 +0000
committerGitHub <noreply@github.com>2020-09-21 12:10:18 +0000
commit84c87fc7d3315ffcc44dde2469a613cb9b5c4190 (patch)
tree6dabef714824027cccc82edad2054838ea7231ec /vendor/github.com/moby/sys/mountinfo/mountinfo.go
parentdd4dc4b002e79c28cd824c59d8f6537d347868cf (diff)
parent8d3c7b4202ac0151417064b89dc35ae6717f2875 (diff)
downloadpodman-84c87fc7d3315ffcc44dde2469a613cb9b5c4190.tar.gz
podman-84c87fc7d3315ffcc44dde2469a613cb9b5c4190.tar.bz2
podman-84c87fc7d3315ffcc44dde2469a613cb9b5c4190.zip
Merge pull request #7665 from containers/dependabot/go_modules/github.com/rootless-containers/rootlesskit-0.10.1
Bump github.com/rootless-containers/rootlesskit from 0.10.0 to 0.10.1
Diffstat (limited to 'vendor/github.com/moby/sys/mountinfo/mountinfo.go')
-rw-r--r--vendor/github.com/moby/sys/mountinfo/mountinfo.go23
1 files changed, 14 insertions, 9 deletions
diff --git a/vendor/github.com/moby/sys/mountinfo/mountinfo.go b/vendor/github.com/moby/sys/mountinfo/mountinfo.go
index 136b14167..1987fcbb2 100644
--- a/vendor/github.com/moby/sys/mountinfo/mountinfo.go
+++ b/vendor/github.com/moby/sys/mountinfo/mountinfo.go
@@ -1,6 +1,9 @@
package mountinfo
-import "io"
+import (
+ "io"
+ "os"
+)
// GetMounts retrieves a list of mounts for the current running process,
// with an optional filter applied (use nil for no filter).
@@ -16,15 +19,17 @@ func GetMountsFromReader(reader io.Reader, f FilterFunc) ([]*Info, error) {
return parseInfoFile(reader, f)
}
-// Mounted determines if a specified mountpoint has been mounted.
-// On Linux it looks at /proc/self/mountinfo.
-func Mounted(mountpoint string) (bool, error) {
- entries, err := GetMounts(SingleEntryFilter(mountpoint))
- if err != nil {
- return false, err
+// Mounted determines if a specified path is a mount point.
+//
+// The argument must be an absolute path, with all symlinks resolved, and clean.
+// One way to ensure it is to process the path using filepath.Abs followed by
+// filepath.EvalSymlinks before calling this function.
+func Mounted(path string) (bool, error) {
+ // root is always mounted
+ if path == string(os.PathSeparator) {
+ return true, nil
}
-
- return len(entries) > 0, nil
+ return mounted(path)
}
// Info reveals information about a particular mounted filesystem. This