helpers.cpp: fix find_executable

- function made the environment variable PATH broken


Origin commit data
------------------
Branch: ni/coolstream
Commit: 356feceb9c
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2014-01-27 (Mon, 27 Jan 2014)



------------------
This commit was generated by Migit
This commit is contained in:
Michael Liebmann
2014-01-27 12:55:25 +01:00
parent 7e4f69a5a7
commit af60d821cc

View File

@@ -293,9 +293,11 @@ bool get_mem_usage(unsigned long &kbtotal, unsigned long &kbfree)
std::string find_executable(const char *name)
{
struct stat s;
char *path = getenv("PATH");
char *p, *n;
if (! path)
char *tmpPath = getenv("PATH");
char *p, *n, *path;
if (tmpPath)
path = strdupa(tmpPath);
else
path = strdupa("/bin:/usr/bin:/sbin:/usr/sbin");
if (name[0] == '/') { /* full path given */
if (!access(name, X_OK) && !stat(name, &s) && S_ISREG(s.st_mode))