(relative_filename): Stop backward search at beginning

of string, since non-Unix systems can have absolute paths with no
initial slash.
This commit is contained in:
Karl Heuer 1999-01-12 21:58:08 +00:00
parent 8de85318d8
commit f6bf1c83d7

View file

@ -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;