diff options
author | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-05-15 15:14:40 +0000 |
---|---|---|
committer | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-05-15 15:14:40 +0000 |
commit | 3d098602b99b7519d6b2321ef6dda943c48db057 (patch) | |
tree | 7e1e2e9b6472c30bab3e9a5af0ef5196e8276ba4 /gcc/prefix.c | |
parent | c1a66faf2b55db558c6157fd20cb1ee12249ee58 (diff) | |
download | gcc-3d098602b99b7519d6b2321ef6dda943c48db057.tar.gz |
2004-05-15 Thomas Quinot <quinot@act-europe.fr>
* prefix.c (update_path): Replace PREFIX with KEY only
when it matches a full directory name in PATH.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@81883 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/prefix.c')
-rw-r--r-- | gcc/prefix.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/gcc/prefix.c b/gcc/prefix.c index df556aaa30c..373707fc595 100644 --- a/gcc/prefix.c +++ b/gcc/prefix.c @@ -238,16 +238,20 @@ tr (char *string, int c1, int c2) while (*string++); } -/* Update PATH using KEY if PATH starts with PREFIX. The returned - string is always malloc-ed, and the caller is responsible for - freeing it. */ +/* Update PATH using KEY if PATH starts with PREFIX as a directory. + The returned string is always malloc-ed, and the caller is + responsible for freeing it. */ char * update_path (const char *path, const char *key) { char *result, *p; + const int len = strlen (std_prefix); - if (! strncmp (path, std_prefix, strlen (std_prefix)) && key != 0) + if (! strncmp (path, std_prefix, len) + && (IS_DIR_SEPARATOR(path[len]) + || path[len] == '\0') + && key != 0) { bool free_key = false; @@ -257,7 +261,7 @@ update_path (const char *path, const char *key) free_key = true; } - result = concat (key, &path[strlen (std_prefix)], NULL); + result = concat (key, &path[len], NULL); if (free_key) free ((char *) key); result = translate_name (result); |