summaryrefslogtreecommitdiff
path: root/src/lread.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-10-04 04:26:09 +0000
committerRichard M. Stallman <rms@gnu.org>1996-10-04 04:26:09 +0000
commitc49afcd7007b6361da51c3b4d952e44ec43bd83f (patch)
treec9f1762c49f9bf241598c027aaf364509da35423 /src/lread.c
parent6d7d9efad3111b3145d6cf46b45f1cebf5faf2ca (diff)
downloademacs-c49afcd7007b6361da51c3b4d952e44ec43bd83f.tar.gz
(openp): Omit /: from start of file name.
Diffstat (limited to 'src/lread.c')
-rw-r--r--src/lread.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/lread.c b/src/lread.c
index 8dab8ee74c4..b74f1554883 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -635,9 +635,22 @@ openp (path, str, suffix, storeptr, exec_only)
char *esuffix = (char *) index (nsuffix, ':');
int lsuffix = esuffix ? esuffix - nsuffix : strlen (nsuffix);
- /* Concatenate path element/specified name with the suffix. */
- strncpy (fn, XSTRING (filename)->data, XSTRING (filename)->size);
- fn[XSTRING (filename)->size] = 0;
+ /* Concatenate path element/specified name with the suffix.
+ If the directory starts with /:, remove that. */
+ if (XSTRING (filename)->size > 2
+ && XSTRING (filename)->data[0] == '/'
+ && XSTRING (filename)->data[1] == ':')
+ {
+ strncpy (fn, XSTRING (filename)->data + 2,
+ XSTRING (filename)->size - 2);
+ fn[XSTRING (filename)->size - 2] = 0;
+ }
+ else
+ {
+ strncpy (fn, XSTRING (filename)->data, XSTRING (filename)->size);
+ fn[XSTRING (filename)->size] = 0;
+ }
+
if (lsuffix != 0) /* Bug happens on CCI if lsuffix is 0. */
strncat (fn, nsuffix, lsuffix);