From af60d821cc2c7259eb8fa4631ef05bf237cdab99 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Mon, 27 Jan 2014 12:55:25 +0100 Subject: [PATCH] helpers.cpp: fix find_executable - function made the environment variable PATH broken Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/356feceb9c93db4eedbf718267f4eecb44b5ae5e Author: Michael Liebmann Date: 2014-01-27 (Mon, 27 Jan 2014) ------------------ This commit was generated by Migit --- src/system/helpers.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index faaab6451..01e76b513 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -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))