diff --git a/unmount_linux.go b/unmount_linux.go index 6fabb35e..cdb06fbe 100644 --- a/unmount_linux.go +++ b/unmount_linux.go @@ -13,6 +13,7 @@ func unmount(dir string) error { if strings.HasPrefix(dir, "/dev/fd/") { return fmt.Errorf("%w: %s", ErrExternallyManagedMountPoint, err) } + return err } return nil } diff --git a/unmount_linux_test.go b/unmount_linux_test.go index 4c357ee7..f2023226 100644 --- a/unmount_linux_test.go +++ b/unmount_linux_test.go @@ -18,7 +18,10 @@ func Test_umountNoCustomError(t *testing.T) { t.Setenv("PATH", "") // Clear PATH to fail unmount with fusermount is not found err := unmount("/dev") - if err != nil && errors.Is(err, ErrExternallyManagedMountPoint) { - t.Errorf("Not expected custom error.") + if err == nil { + t.Fatal("Expected error but got none.") + } + if errors.Is(err, ErrExternallyManagedMountPoint) { + t.Error("Custom error was not expected.") } }