Skip to content
Snippets Groups Projects
Commit cf8beae3 authored by Rolf Eike Beer's avatar Rolf Eike Beer
Browse files

ProcessUNIX: use strdup() instead of open coding it

parent e75d1a31
No related branches found
No related tags found
No related merge requests found
......@@ -498,11 +498,10 @@ int kwsysProcess_SetWorkingDirectory(kwsysProcess* cp, const char* dir)
cp->WorkingDirectory = 0;
}
if (dir) {
cp->WorkingDirectory = (char*)malloc(strlen(dir) + 1);
cp->WorkingDirectory = strdup(dir);
if (!cp->WorkingDirectory) {
return 0;
}
strcpy(cp->WorkingDirectory, dir);
}
return 1;
}
......@@ -531,11 +530,10 @@ int kwsysProcess_SetPipeFile(kwsysProcess* cp, int prPipe, const char* file)
*pfile = 0;
}
if (file) {
*pfile = (char*)malloc(strlen(file) + 1);
*pfile = strdup(file);
if (!*pfile) {
return 0;
}
strcpy(*pfile, file);
}
/* If we are redirecting the pipe, do not share it or use a native
......
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