From: Karl Heuer Date: Tue, 12 Jan 1999 21:58:08 +0000 (+0000) Subject: (relative_filename): Stop backward search at beginning X-Git-Tag: emacs-20.4~890 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f6bf1c83d76a674ba316c1d7285e25058f399441;p=emacs.git (relative_filename): Stop backward search at beginning of string, since non-Unix systems can have absolute paths with no initial slash. --- diff --git a/lib-src/etags.c b/lib-src/etags.c index 22e6d35ae10..b838d90b636 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;