mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 08:51:10 +02:00
helpers.cpp: fix find_executable
- function made the environment variable PATH broken
This commit is contained in:
committed by
M. Liebmann
parent
1ee458e461
commit
356feceb9c
@@ -293,9 +293,11 @@ bool get_mem_usage(unsigned long &kbtotal, unsigned long &kbfree)
|
|||||||
std::string find_executable(const char *name)
|
std::string find_executable(const char *name)
|
||||||
{
|
{
|
||||||
struct stat s;
|
struct stat s;
|
||||||
char *path = getenv("PATH");
|
char *tmpPath = getenv("PATH");
|
||||||
char *p, *n;
|
char *p, *n, *path;
|
||||||
if (! path)
|
if (tmpPath)
|
||||||
|
path = strdupa(tmpPath);
|
||||||
|
else
|
||||||
path = strdupa("/bin:/usr/bin:/sbin:/usr/sbin");
|
path = strdupa("/bin:/usr/bin:/sbin:/usr/sbin");
|
||||||
if (name[0] == '/') { /* full path given */
|
if (name[0] == '/') { /* full path given */
|
||||||
if (!access(name, X_OK) && !stat(name, &s) && S_ISREG(s.st_mode))
|
if (!access(name, X_OK) && !stat(name, &s) && S_ISREG(s.st_mode))
|
||||||
|
Reference in New Issue
Block a user