diff options
| author | Paul Eggert | 2019-09-12 00:25:47 -0700 |
|---|---|---|
| committer | Paul Eggert | 2019-09-12 00:27:38 -0700 |
| commit | c19f5dcd474bfc883fc7555eef7d8f50a0df3157 (patch) | |
| tree | 098b221fa40a26dc9443895efaf8cd894868b573 /src/dired.c | |
| parent | ffa870fc806451b9bd4504bebbf9085f4b4c0be8 (diff) | |
| download | emacs-c19f5dcd474bfc883fc7555eef7d8f50a0df3157.tar.gz emacs-c19f5dcd474bfc883fc7555eef7d8f50a0df3157.zip | |
Fix file name encoding when open_directory signals
* src/dired.c (open_directory): New arg ENCODED_DIRNAME.
All callers changed. Signal error with original name,
not encoded name.
Diffstat (limited to 'src/dired.c')
| -rw-r--r-- | src/dired.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/dired.c b/src/dired.c index 58fa848e2e3..cec79ab46be 100644 --- a/src/dired.c +++ b/src/dired.c | |||
| @@ -79,9 +79,9 @@ dirent_type (struct dirent *dp) | |||
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | static DIR * | 81 | static DIR * |
| 82 | open_directory (Lisp_Object dirname, int *fdp) | 82 | open_directory (Lisp_Object dirname, Lisp_Object encoded_dirname, int *fdp) |
| 83 | { | 83 | { |
| 84 | char *name = SSDATA (dirname); | 84 | char *name = SSDATA (encoded_dirname); |
| 85 | DIR *d; | 85 | DIR *d; |
| 86 | int fd, opendir_errno; | 86 | int fd, opendir_errno; |
| 87 | 87 | ||
| @@ -187,11 +187,11 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, | |||
| 187 | /* Note: ENCODE_FILE and DECODE_FILE can GC because they can run | 187 | /* Note: ENCODE_FILE and DECODE_FILE can GC because they can run |
| 188 | run_pre_post_conversion_on_str which calls Lisp directly and | 188 | run_pre_post_conversion_on_str which calls Lisp directly and |
| 189 | indirectly. */ | 189 | indirectly. */ |
| 190 | dirfilename = ENCODE_FILE (dirfilename); | 190 | Lisp_Object encoded_dirfilename = ENCODE_FILE (dirfilename); |
| 191 | encoded_directory = ENCODE_FILE (directory); | 191 | encoded_directory = ENCODE_FILE (directory); |
| 192 | 192 | ||
| 193 | int fd; | 193 | int fd; |
| 194 | DIR *d = open_directory (dirfilename, &fd); | 194 | DIR *d = open_directory (dirfilename, encoded_dirfilename, &fd); |
| 195 | 195 | ||
| 196 | /* Unfortunately, we can now invoke expand-file-name and | 196 | /* Unfortunately, we can now invoke expand-file-name and |
| 197 | file-attributes on filenames, both of which can throw, so we must | 197 | file-attributes on filenames, both of which can throw, so we must |
| @@ -210,7 +210,7 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, | |||
| 210 | { | 210 | { |
| 211 | /* w32.c:stat will notice these bindings and avoid calling | 211 | /* w32.c:stat will notice these bindings and avoid calling |
| 212 | GetDriveType for each file. */ | 212 | GetDriveType for each file. */ |
| 213 | if (is_slow_fs (SSDATA (dirfilename))) | 213 | if (is_slow_fs (SSDATA (encoded_dirfilename))) |
| 214 | Vw32_get_true_file_attributes = Qnil; | 214 | Vw32_get_true_file_attributes = Qnil; |
| 215 | else | 215 | else |
| 216 | Vw32_get_true_file_attributes = Qt; | 216 | Vw32_get_true_file_attributes = Qt; |
| @@ -509,7 +509,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag, | |||
| 509 | } | 509 | } |
| 510 | } | 510 | } |
| 511 | int fd; | 511 | int fd; |
| 512 | DIR *d = open_directory (encoded_dir, &fd); | 512 | DIR *d = open_directory (dirname, encoded_dir, &fd); |
| 513 | record_unwind_protect_ptr (directory_files_internal_unwind, d); | 513 | record_unwind_protect_ptr (directory_files_internal_unwind, d); |
| 514 | 514 | ||
| 515 | /* Loop reading directory entries. */ | 515 | /* Loop reading directory entries. */ |