e start - path manipulation - don't add a : if there already is one

avoids adding more : chars to make a broken path even worse
This commit is contained in:
Carsten Haitzler 2015-05-27 08:43:13 +09:00
parent 6ba90335e2
commit b3cc1dc364
1 changed files with 5 additions and 2 deletions

View File

@ -215,7 +215,7 @@ _env_path_prepend(const char *env, const char *path)
strcat(s, p2); strcat(s, p2);
if (p) if (p)
{ {
strcat(s, ":"); if (p[0] != ':') strcat(s, ":");
strcat(s, p); strcat(s, p);
} }
env_set(env, s); env_set(env, s);
@ -252,7 +252,10 @@ _env_path_append(const char *env, const char *path)
if (p) if (p)
{ {
strcat(s, p); strcat(s, p);
strcat(s, ":"); if (len > 0)
{
if (s[len - 1] != ':') strcat(s, ":");
}
} }
strcat(s, p2); strcat(s, p2);
env_set(env, s); env_set(env, s);