aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src/etags.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib-src/etags.c')
-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;