aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/moby/sys/mount/unmount_unix.go
blob: 924d059a7d28564e6d64b8450ec3e2b7af001a48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// +build !windows

package mount

import "golang.org/x/sys/unix"

func unmountBare(target string, flags int) error {
	return unix.Unmount(target, flags)
}

func unmount(target string, flags int) error {
	err := unmountBare(target, flags)
	if err == nil || err == unix.EINVAL {
		// Ignore "not mounted" error here. Note the same error
		// can be returned if flags are invalid, so this code
		// assumes that the flags value is always correct.
		return nil
	}

	return &mountError{
		op:     "umount",
		target: target,
		flags:  uintptr(flags),
		err:    err,
	}
}