From 320dc6c54c1fc51d7c6ee1265a13a5e6111f4222 Mon Sep 17 00:00:00 2001 From: Ted Yu Date: Mon, 10 Jun 2019 20:40:39 -0700 Subject: [PATCH] Return early when mount ref is determined --- pkg/util/mount/mount.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/util/mount/mount.go b/pkg/util/mount/mount.go index 96dc68c9a03..a2b89c8dcc0 100644 --- a/pkg/util/mount/mount.go +++ b/pkg/util/mount/mount.go @@ -313,13 +313,12 @@ func checkForNetDev(options []string) bool { // Plan to work on better approach to solve this issue. func HasMountRefs(mountPath string, mountRefs []string) bool { - count := 0 for _, ref := range mountRefs { if !strings.Contains(ref, mountPath) { - count = count + 1 + return true } } - return count > 0 + return false } // PathWithinBase checks if give path is within given base directory.