diff options
| author | Richard M. Stallman | 1995-04-01 04:46:15 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-04-01 04:46:15 +0000 |
| commit | 5617588f56536ea69074d0e8dc0a80a82b0a3ca8 (patch) | |
| tree | ae0afd36560619fb845e9fd977271f7403a29e9f | |
| parent | 387f203c002d4dcef2999cba91428debff161df6 (diff) | |
| download | emacs-5617588f56536ea69074d0e8dc0a80a82b0a3ca8.tar.gz emacs-5617588f56536ea69074d0e8dc0a80a82b0a3ca8.zip | |
(Fdirectory_files): Fix bug in IS_ANY_SEP usage introduced in Oct 30 change.
| -rw-r--r-- | src/dired.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/dired.c b/src/dired.c index d012eaaa140..39c64d28393 100644 --- a/src/dired.c +++ b/src/dired.c | |||
| @@ -113,7 +113,7 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable.\n\ | |||
| 113 | Lisp_Object dirname, full, match, nosort; | 113 | Lisp_Object dirname, full, match, nosort; |
| 114 | { | 114 | { |
| 115 | DIR *d; | 115 | DIR *d; |
| 116 | int length; | 116 | int dirnamelen; |
| 117 | Lisp_Object list, name, dirfilename; | 117 | Lisp_Object list, name, dirfilename; |
| 118 | Lisp_Object handler; | 118 | Lisp_Object handler; |
| 119 | struct re_pattern_buffer *bufp; | 119 | struct re_pattern_buffer *bufp; |
| @@ -174,7 +174,7 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable.\n\ | |||
| 174 | report_file_error ("Opening directory", Fcons (dirname, Qnil)); | 174 | report_file_error ("Opening directory", Fcons (dirname, Qnil)); |
| 175 | 175 | ||
| 176 | list = Qnil; | 176 | list = Qnil; |
| 177 | length = XSTRING (dirname)->size; | 177 | dirnamelen = XSTRING (dirname)->size; |
| 178 | 178 | ||
| 179 | /* Loop reading blocks */ | 179 | /* Loop reading blocks */ |
| 180 | while (1) | 180 | while (1) |
| @@ -191,23 +191,24 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable.\n\ | |||
| 191 | { | 191 | { |
| 192 | if (!NILP (full)) | 192 | if (!NILP (full)) |
| 193 | { | 193 | { |
| 194 | int index = XSTRING (dirname)->size; | 194 | int afterdirindex = dirnamelen; |
| 195 | int total = len + index; | 195 | int total = len + dirnamelen; |
| 196 | int needsep = 0; | ||
| 197 | |||
| 198 | /* Decide whether we need to add a directory separator. */ | ||
| 196 | #ifndef VMS | 199 | #ifndef VMS |
| 197 | if (length == 0 | 200 | if (dirnamelen == 0 |
| 198 | || !IS_ANY_SEP (XSTRING (dirname)->data[length - 1])) | 201 | || !IS_ANY_SEP (XSTRING (dirname)->data[dirnamelen - 1])) |
| 199 | total++; | 202 | needsep = 1; |
| 200 | #endif /* VMS */ | 203 | #endif /* VMS */ |
| 201 | 204 | ||
| 202 | name = make_uninit_string (total); | 205 | name = make_uninit_string (total + needsep); |
| 203 | bcopy (XSTRING (dirname)->data, XSTRING (name)->data, | 206 | bcopy (XSTRING (dirname)->data, XSTRING (name)->data, |
| 204 | index); | 207 | dirnamelen); |
| 205 | #ifndef VMS | 208 | if (needsep) |
| 206 | if (length == 0 | 209 | XSTRING (name)->data[afterdirindex++] = DIRECTORY_SEP; |
| 207 | || IS_ANY_SEP (XSTRING (dirname)->data[length - 1])) | 210 | bcopy (dp->d_name, |
| 208 | XSTRING (name)->data[index++] = DIRECTORY_SEP; | 211 | XSTRING (name)->data + afterdirindex, len); |
| 209 | #endif /* VMS */ | ||
| 210 | bcopy (dp->d_name, XSTRING (name)->data + index, len); | ||
| 211 | } | 212 | } |
| 212 | else | 213 | else |
| 213 | name = make_string (dp->d_name, len); | 214 | name = make_string (dp->d_name, len); |