diff --git a/libpod/volume_internal_common.go b/libpod/volume_internal_common.go index 440bceec30..c85782e4be 100644 --- a/libpod/volume_internal_common.go +++ b/libpod/volume_internal_common.go @@ -180,7 +180,7 @@ func (v *Volume) unmount(force bool) error { } // Unmount the volume - if err := unix.Unmount(v.config.MountPoint, unix.MNT_DETACH); err != nil { + if err := detachUnmount(v.config.MountPoint); err != nil { if err == unix.EINVAL { // Ignore EINVAL - the mount no longer exists. return nil diff --git a/libpod/volume_internal_linux.go b/libpod/volume_internal_linux.go new file mode 100644 index 0000000000..eb4309dc31 --- /dev/null +++ b/libpod/volume_internal_linux.go @@ -0,0 +1,9 @@ +package libpod + +import ( + "golang.org/x/sys/unix" +) + +func detachUnmount(mountPoint string) error { + return unix.Unmount(mountPoint, unix.MNT_DETACH) +}