From eeab052425d111a7031125acf4765741cedf3300 Mon Sep 17 00:00:00 2001 From: Kohei Tokunaga Date: Tue, 31 Jan 2023 22:07:44 +0900 Subject: [PATCH] Make `mount.UnmountRecursive` compatible to `mount.UnmountAll` Signed-off-by: Kohei Tokunaga --- mount/mount_unix.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mount/mount_unix.go b/mount/mount_unix.go index 9645a46e3..46dfd1c34 100644 --- a/mount/mount_unix.go +++ b/mount/mount_unix.go @@ -27,6 +27,9 @@ import ( // UnmountRecursive unmounts the target and all mounts underneath, starting // with the deepest mount first. func UnmountRecursive(target string, flags int) error { + if target == "" { + return nil + } mounts, err := mountinfo.GetMounts(mountinfo.PrefixFilter(target)) if err != nil { return err