mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 07:51:11 +02:00
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:
@@ -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