diff options
Diffstat (limited to 'src/lread.c')
| -rw-r--r-- | src/lread.c | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/src/lread.c b/src/lread.c index bd85e44093e..640414b3e91 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -1495,26 +1495,14 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *sto | |||
| 1495 | 1495 | ||
| 1496 | /* Concatenate path element/specified name with the suffix. | 1496 | /* Concatenate path element/specified name with the suffix. |
| 1497 | If the directory starts with /:, remove that. */ | 1497 | If the directory starts with /:, remove that. */ |
| 1498 | if (SCHARS (filename) > 2 | 1498 | int prefixlen = ((SCHARS (filename) > 2 |
| 1499 | && SREF (filename, 0) == '/' | 1499 | && SREF (filename, 0) == '/' |
| 1500 | && SREF (filename, 1) == ':') | 1500 | && SREF (filename, 1) == ':') |
| 1501 | { | 1501 | ? 2 : 0); |
| 1502 | fnlen = SBYTES (filename) - 2; | 1502 | fnlen = SBYTES (filename) - prefixlen; |
| 1503 | strncpy (fn, SSDATA (filename) + 2, fnlen); | 1503 | memcpy (fn, SDATA (filename) + prefixlen, fnlen); |
| 1504 | fn[fnlen] = '\0'; | 1504 | memcpy (fn + fnlen, SDATA (XCAR (tail)), lsuffix + 1); |
| 1505 | } | 1505 | fnlen += lsuffix; |
| 1506 | else | ||
| 1507 | { | ||
| 1508 | fnlen = SBYTES (filename); | ||
| 1509 | strncpy (fn, SSDATA (filename), fnlen); | ||
| 1510 | fn[fnlen] = '\0'; | ||
| 1511 | } | ||
| 1512 | |||
| 1513 | if (lsuffix != 0) /* Bug happens on CCI if lsuffix is 0. */ | ||
| 1514 | { | ||
| 1515 | strncat (fn, SSDATA (XCAR (tail)), lsuffix); | ||
| 1516 | fnlen += lsuffix; | ||
| 1517 | } | ||
| 1518 | /* Check that the file exists and is not a directory. */ | 1506 | /* Check that the file exists and is not a directory. */ |
| 1519 | /* We used to only check for handlers on non-absolute file names: | 1507 | /* We used to only check for handlers on non-absolute file names: |
| 1520 | if (absolute) | 1508 | if (absolute) |