emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master c19f5dc: Fix file name encoding when open_directory


From: Paul Eggert
Subject: [Emacs-diffs] master c19f5dc: Fix file name encoding when open_directory signals
Date: Thu, 12 Sep 2019 03:27:43 -0400 (EDT)

branch: master
commit c19f5dcd474bfc883fc7555eef7d8f50a0df3157
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    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.
---
 src/dired.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/dired.c b/src/dired.c
index 58fa848..cec79ab 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -79,9 +79,9 @@ dirent_type (struct dirent *dp)
 }
 
 static DIR *
-open_directory (Lisp_Object dirname, int *fdp)
+open_directory (Lisp_Object dirname, Lisp_Object encoded_dirname, int *fdp)
 {
-  char *name = SSDATA (dirname);
+  char *name = SSDATA (encoded_dirname);
   DIR *d;
   int fd, opendir_errno;
 
@@ -187,11 +187,11 @@ directory_files_internal (Lisp_Object directory, 
Lisp_Object full,
   /* Note: ENCODE_FILE and DECODE_FILE can GC because they can run
      run_pre_post_conversion_on_str which calls Lisp directly and
      indirectly.  */
-  dirfilename = ENCODE_FILE (dirfilename);
+  Lisp_Object encoded_dirfilename = ENCODE_FILE (dirfilename);
   encoded_directory = ENCODE_FILE (directory);
 
   int fd;
-  DIR *d = open_directory (dirfilename, &fd);
+  DIR *d = open_directory (dirfilename, encoded_dirfilename, &fd);
 
   /* Unfortunately, we can now invoke expand-file-name and
      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,
        {
          /* w32.c:stat will notice these bindings and avoid calling
             GetDriveType for each file.  */
-         if (is_slow_fs (SSDATA (dirfilename)))
+         if (is_slow_fs (SSDATA (encoded_dirfilename)))
            Vw32_get_true_file_attributes = Qnil;
          else
            Vw32_get_true_file_attributes = Qt;
@@ -509,7 +509,7 @@ file_name_completion (Lisp_Object file, Lisp_Object 
dirname, bool all_flag,
        }
     }
   int fd;
-  DIR *d = open_directory (encoded_dir, &fd);
+  DIR *d = open_directory (dirname, encoded_dir, &fd);
   record_unwind_protect_ptr (directory_files_internal_unwind, d);
 
   /* Loop reading directory entries.  */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]