Skip to content
Snippets Groups Projects
Commit b67561f8 authored by Andy Cedilnik's avatar Andy Cedilnik
Browse files

BUG: Fix valgrind error. If working directory is not set do not do chdir

parent 449919bf
No related branches found
No related tags found
No related merge requests found
......@@ -1044,20 +1044,21 @@ static int kwsysProcessInitialize(kwsysProcess* cp)
memset(cp->CommandExitCodes, 0, sizeof(int)*cp->NumberOfCommands);
/* Allocate memory to save the real working directory. */
{
if ( cp->WorkingDirectory )
{
#if defined(MAXPATHLEN)
cp->RealWorkingDirectoryLength = MAXPATHLEN;
cp->RealWorkingDirectoryLength = MAXPATHLEN;
#elif defined(PATH_MAX)
cp->RealWorkingDirectoryLength = PATH_MAX;
cp->RealWorkingDirectoryLength = PATH_MAX;
#else
cp->RealWorkingDirectoryLength = 4096;
cp->RealWorkingDirectoryLength = 4096;
#endif
cp->RealWorkingDirectory = malloc(cp->RealWorkingDirectoryLength);
if(!cp->RealWorkingDirectory)
{
return 0;
cp->RealWorkingDirectory = malloc(cp->RealWorkingDirectoryLength);
if(!cp->RealWorkingDirectory)
{
return 0;
}
}
}
return 1;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment