]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix open-dribble-file's treatment of non-ASCII file names.
authorEli Zaretskii <eliz@gnu.org>
Sun, 13 Apr 2014 10:45:46 +0000 (13:45 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sun, 13 Apr 2014 10:45:46 +0000 (13:45 +0300)
 src/keyboard.c (Fopen_dribble_file): Encode the dribble file-name
 before passing it to system APIs.

src/ChangeLog
src/keyboard.c

index 2deeb61b95c713b69c9ebe8e3eaeede172c85578..d885863d73cbcae28977638be48271147823175e 100644 (file)
@@ -1,5 +1,8 @@
 2014-04-13  Eli Zaretskii  <eliz@gnu.org>
 
+       * keyboard.c (Fopen_dribble_file): Encode the dribble file-name
+       before passing it to system APIs.
+
        * puresize.h (BASE_PURESIZE): Bump by 1K.  (Bug#17255)
 
 2014-04-13  Stefan Monnier  <monnier@iro.umontreal.ca>
index a66054f153fc96638c15915927cc69191fa646c3..1f4b23d9905af52a8752717380a6f9db79a48d96 100644 (file)
@@ -10087,10 +10087,13 @@ This may include sensitive information such as passwords.  */)
   if (!NILP (file))
     {
       int fd;
+      Lisp_Object encfile;
+
       file = Fexpand_file_name (file, Qnil);
-      fd = emacs_open (SSDATA (file), O_WRONLY | O_CREAT | O_EXCL, 0600);
-      if (fd < 0 && errno == EEXIST && unlink (SSDATA (file)) == 0)
-       fd = emacs_open (SSDATA (file), O_WRONLY | O_CREAT | O_EXCL, 0600);
+      encfile = ENCODE_FILE (file);
+      fd = emacs_open (SSDATA (encfile), O_WRONLY | O_CREAT | O_EXCL, 0600);
+      if (fd < 0 && errno == EEXIST && unlink (SSDATA (encfile)) == 0)
+       fd = emacs_open (SSDATA (encfile), O_WRONLY | O_CREAT | O_EXCL, 0600);
       dribble = fd < 0 ? 0 : fdopen (fd, "w");
       if (dribble == 0)
        report_file_error ("Opening dribble", file);