summaryrefslogtreecommitdiff
path: root/vendor/github.com/moby/sys/mountinfo/mountinfo.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2020-09-17 16:16:53 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2020-09-17 16:20:10 -0400
commit8d3c7b4202ac0151417064b89dc35ae6717f2875 (patch)
treea99d665aa6ea1ce7c47fcc20cb2d8e549807380d /vendor/github.com/moby/sys/mountinfo/mountinfo.go
parentf84f441bec8d4ad6b6dfce059ca71dbd2b0d9615 (diff)
downloadpodman-8d3c7b4202ac0151417064b89dc35ae6717f2875.tar.gz
podman-8d3c7b4202ac0151417064b89dc35ae6717f2875.tar.bz2
podman-8d3c7b4202ac0151417064b89dc35ae6717f2875.zip
Bump github.com/rootless-containers/rootlesskit from 0.10.0 to 0.10.1
Bumps [github.com/rootless-containers/rootlesskit](https://github.com/rootless-containers/rootlesskit) from 0.10.0 to 0.10.1. - [Release notes](https://github.com/rootless-containers/rootlesskit/releases) - [Commits](https://github.com/rootless-containers/rootlesskit/compare/v0.10.0...v0.10.1) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
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