2018-12-31 00:45:37 -05:00
|
|
|
// +build !windows
|
|
|
|
|
2020-04-16 05:23:37 -04:00
|
|
|
package mount
|
2018-12-31 00:45:37 -05:00
|
|
|
|
|
|
|
import "golang.org/x/sys/unix"
|
|
|
|
|
|
|
|
func unmount(target string, flags int) error {
|
|
|
|
err := unix.Unmount(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,
|
|
|
|
}
|
|
|
|
}
|