From cffc7285306d4c2e70e940ed9842c4dbd78ebcfb Mon Sep 17 00:00:00 2001 From: Qi Xiao Date: Mon, 22 Feb 2016 23:46:18 +0100 Subject: [PATCH] Don't search whenever external command contains /. This fixes #150. --- util/search.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/util/search.go b/util/search.go index f4f360bb..a2507399 100644 --- a/util/search.go +++ b/util/search.go @@ -47,10 +47,7 @@ func AllExecutables(paths []string, names chan<- string) { // DontSearch determines whether the path to an external command should be // taken literally and not searched. func DontSearch(exe string) bool { - return exe == ".." || - strings.HasPrefix(exe, "/") || - strings.HasPrefix(exe, "./") || - strings.HasPrefix(exe, "../") + return exe == ".." || strings.ContainsRune(exe, '/') } // IsExecutable determines whether path refers to an executable file.