diff options
| author | Eli Zaretskii | 2014-04-13 13:45:46 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2014-04-13 13:45:46 +0300 |
| commit | ced78c5a65b64b0e520b03cd3a987374ea4ca7d2 (patch) | |
| tree | 0bfd621bb3f145f31046bdfa061ef34fc743e5c0 | |
| parent | f2d164a4c6f3f0eb6f175b57012738aeaad2f294 (diff) | |
| download | emacs-ced78c5a65b64b0e520b03cd3a987374ea4ca7d2.tar.gz emacs-ced78c5a65b64b0e520b03cd3a987374ea4ca7d2.zip | |
Fix open-dribble-file's treatment of non-ASCII file names.
src/keyboard.c (Fopen_dribble_file): Encode the dribble file-name
before passing it to system APIs.
| -rw-r--r-- | src/ChangeLog | 3 | ||||
| -rw-r--r-- | src/keyboard.c | 9 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 2deeb61b95c..d885863d73c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2014-04-13 Eli Zaretskii <eliz@gnu.org> | 1 | 2014-04-13 Eli Zaretskii <eliz@gnu.org> |
| 2 | 2 | ||
| 3 | * keyboard.c (Fopen_dribble_file): Encode the dribble file-name | ||
| 4 | before passing it to system APIs. | ||
| 5 | |||
| 3 | * puresize.h (BASE_PURESIZE): Bump by 1K. (Bug#17255) | 6 | * puresize.h (BASE_PURESIZE): Bump by 1K. (Bug#17255) |
| 4 | 7 | ||
| 5 | 2014-04-13 Stefan Monnier <monnier@iro.umontreal.ca> | 8 | 2014-04-13 Stefan Monnier <monnier@iro.umontreal.ca> |
diff --git a/src/keyboard.c b/src/keyboard.c index a66054f153f..1f4b23d9905 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -10087,10 +10087,13 @@ This may include sensitive information such as passwords. */) | |||
| 10087 | if (!NILP (file)) | 10087 | if (!NILP (file)) |
| 10088 | { | 10088 | { |
| 10089 | int fd; | 10089 | int fd; |
| 10090 | Lisp_Object encfile; | ||
| 10091 | |||
| 10090 | file = Fexpand_file_name (file, Qnil); | 10092 | file = Fexpand_file_name (file, Qnil); |
| 10091 | fd = emacs_open (SSDATA (file), O_WRONLY | O_CREAT | O_EXCL, 0600); | 10093 | encfile = ENCODE_FILE (file); |
| 10092 | if (fd < 0 && errno == EEXIST && unlink (SSDATA (file)) == 0) | 10094 | fd = emacs_open (SSDATA (encfile), O_WRONLY | O_CREAT | O_EXCL, 0600); |
| 10093 | fd = emacs_open (SSDATA (file), O_WRONLY | O_CREAT | O_EXCL, 0600); | 10095 | if (fd < 0 && errno == EEXIST && unlink (SSDATA (encfile)) == 0) |
| 10096 | fd = emacs_open (SSDATA (encfile), O_WRONLY | O_CREAT | O_EXCL, 0600); | ||
| 10094 | dribble = fd < 0 ? 0 : fdopen (fd, "w"); | 10097 | dribble = fd < 0 ? 0 : fdopen (fd, "w"); |
| 10095 | if (dribble == 0) | 10098 | if (dribble == 0) |
| 10096 | report_file_error ("Opening dribble", file); | 10099 | report_file_error ("Opening dribble", file); |