aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer <[email protected]>1999-01-12 21:58:08 +0000
committerKarl Heuer <[email protected]>1999-01-12 21:58:08 +0000
commitf6bf1c83d76a674ba316c1d7285e25058f399441 (patch)
treeab011e04e7ef9e5704b7463502b0f34dcadd65bd
parent8de85318d84560083ab663f30042d1a775fae7bd (diff)
(relative_filename): Stop backward search at beginning
of string, since non-Unix systems can have absolute paths with no initial slash.
-rw-r--r--lib-src/etags.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 22e6d35ae1..b838d90b63 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -4714,9 +4714,10 @@ relative_filename (file, dir)
while (*fp++ == *dp++)
continue;
fp--, dp--; /* back to the first differing char */
- do /* look at the equal chars until '/' */
+ do { /* look at the equal chars until '/' */
+ if (fp == abs) return abs; /* first char differs, give up */
fp--, dp--;
- while (*fp != '/');
+ } while (*fp != '/');
/* Build a sequence of "../" strings for the resulting relative file name. */
i = 0;