and dont prepend to path if already there.

SVN revision: 73431
This commit is contained in:
Carsten Haitzler 2012-07-07 01:44:48 +00:00
parent 6188192e4e
commit 1a7b0b4412
1 changed files with 8 additions and 0 deletions

View File

@ -150,6 +150,14 @@ _env_path_prepend(const char *env, const char *path)
if (p) len = strlen(p);
p2 = (char *)path;
if (p2) len2 = strlen(p2);
if (p && p2)
{
// path already there at the start. dont prepend. :)
if ((!strncmp(p, p2, strlen(p2))) &&
(len > len2) &&
(p[len2] == ':'))
return;
}
s = malloc(len + 1 + len2 + 1);
if (s)
{