summaryrefslogtreecommitdiff
path: root/lib/System
diff options
context:
space:
mode:
Diffstat (limited to 'lib/System')
-rw-r--r--lib/System/Unix/Program.inc6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/System/Unix/Program.inc b/lib/System/Unix/Program.inc
index d4e88fd6d1..7e82ef3f93 100644
--- a/lib/System/Unix/Program.inc
+++ b/lib/System/Unix/Program.inc
@@ -45,9 +45,9 @@ Program::FindProgramByName(const std::string& progName) {
Path temp;
if (!temp.set(progName)) // invalid name
return Path();
- // FIXME: have to check for absolute filename - we cannot assume anything
- // about "." being in $PATH
- if (temp.canExecute()) // already executable as is
+ // Use the given path verbatim if it contains any slashes; this matches
+ // the behavior of sh(1) and friends.
+ if (progName.find('/') != std::string::npos && temp.canExecute())
return temp;
// At this point, the file name is valid and its not executable