From 0235891665ad311e1f81d1b0f003f433b4af4cbb Mon Sep 17 00:00:00 2001 From: marha Date: Thu, 25 Feb 2010 11:16:55 +0000 Subject: Solved problem when path environment variable was larger then 1024 bytes --- tools/mhmake/src/build.cpp | 8 ++++---- tools/mhmake/src/mhmakefileparser.h | 2 +- tools/mhmake/src/util.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'tools') diff --git a/tools/mhmake/src/build.cpp b/tools/mhmake/src/build.cpp index 064ffe6c9..57cd94b79 100644 --- a/tools/mhmake/src/build.cpp +++ b/tools/mhmake/src/build.cpp @@ -240,7 +240,7 @@ void mhmakefileparser::CreatePythonExe(const string &FullCommand) #endif /*****************************************************************************/ -int mhmakefileparser::SearchPath(void *NotUsed, const char *szCommand, const char *pExt, int Len, char *szFullCommand,char **pFilePart) const +int mhmakefileparser::SearchPath(const char *szCommand, const char *pExt, int Len, char *szFullCommand,char **pFilePart) const { static vector< refptr > vSearchPath; @@ -258,17 +258,17 @@ int mhmakefileparser::SearchPath(void *NotUsed, const char *szCommand, const cha CommandFile->InvalidateDate(); // It could be created in the makefile later if (!vSearchPath.size()) { - char Path[1024]; char *pPath=getenv(PATH); if (!pPath) return 0; - strcpy(Path,pPath); // To be able to use strtok + char *Path=strdup(pPath); // To be able to use strtok char *pTok=strtok(Path,OSPATHENVSEPSTR); while (pTok) { vSearchPath.push_back(GetFileInfo(pTok,m_MakeDir)); pTok=strtok(NULL,OSPATHENVSEPSTR); } + free(Path); } It=vSearchPath.begin(); ItEnd=vSearchPath.end(); @@ -303,7 +303,7 @@ string mhmakefileparser::SearchCommand(const string &Command, const string &Exte pExt=NULL; else pExt=Extension.c_str(); - if (SearchPath(NULL,UnquoteFileName(Command).c_str(),pExt,MAX_PATH,FullCommand,NULL)) + if (SearchPath(UnquoteFileName(Command).c_str(),pExt,MAX_PATH,FullCommand,NULL)) return FullCommand; #ifdef WIN32 /* See if we have a path for python.exe in the registry */ diff --git a/tools/mhmake/src/mhmakefileparser.h b/tools/mhmake/src/mhmakefileparser.h index 43bcad538..b37e96466 100644 --- a/tools/mhmake/src/mhmakefileparser.h +++ b/tools/mhmake/src/mhmakefileparser.h @@ -355,7 +355,7 @@ public: mh_pid_t EchoCommand(const string &Params) const; string SearchCommand(const string &Command, const string &Extension="") const; const string &GetPythonExe() const; - int SearchPath(void *NotUsed, const char *szCommand, const char *pExt, int Len, char *szFullCommand,char **pFilePart) const; + int SearchPath(const char *szCommand, const char *pExt, int Len, char *szFullCommand,char **pFilePart) const; mh_pid_t OsExeCommand(const string &Command, const string &Params, bool IgnoreError, string *pOutput) const; }; diff --git a/tools/mhmake/src/util.h b/tools/mhmake/src/util.h index 9e5948448..9deb700c7 100644 --- a/tools/mhmake/src/util.h +++ b/tools/mhmake/src/util.h @@ -50,7 +50,7 @@ #define PLATFORM "linux" #endif -#define MHMAKEVER "2.0.1" +#define MHMAKEVER "2.0.2" class makecommand { -- cgit v1.2.3