Angus Leeming wrote:
> Specifically, I suspect that something is going wrong with getEnvPath
> which attempts to create a vector of paths from $PATH
> "/foo/bar:/usr/bin".

>     // 2. exe must be the name of the binary only and it
>     // can be found on the PATH.
>     string const exe_name = OnlyFilename(exe_path);
>     if (exe_name != exe_path)
>         return string();
> 
>     std::vector<string> const path = getEnvPath("PATH");
>     std::vector<string>::const_iterator it = path.begin();
>     std::vector<string>::const_iterator const end = path.end();
>     for (; it != end; ++it) {

This logic is wrong, isn't it? There's nothing to prevent a PATH element 
from being a relative path.

>         if (!os::is_absolute_path(*it))
>             // Someone is playing silly buggers.
>             continue;
> 
>         string const exe_path = AddName(*it, exe_name);
>         if (FileInfo(exe_path, true).isOK())
>             return exe_path;
>     }
> 
>     // Didn't find anything.
>     return string();


-- 
Angus

Reply via email to