diff options
| author | Glenn Morris | 2014-04-10 22:47:32 -0700 |
|---|---|---|
| committer | Glenn Morris | 2014-04-10 22:47:32 -0700 |
| commit | 34e083e3608c39f4c0cc71354eda8553230b3acc (patch) | |
| tree | 9ddc09bd917c88a2bcf7b3c4617298349aa93cce /src | |
| parent | 20f39add49aee6b55778edd4dc3aa86516928e8d (diff) | |
| download | emacs-34e083e3608c39f4c0cc71354eda8553230b3acc.tar.gz emacs-34e083e3608c39f4c0cc71354eda8553230b3acc.zip | |
* src/keyboard.c (Fopen_dribble_file): Make file private.
Fixes: debbugs:17187
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/keyboard.c | 13 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index e2c925f03d3..9d59ab1c97c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2014-04-11 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * keyboard.c (Fopen_dribble_file): Make file private. (Bug#17187) | ||
| 4 | |||
| 1 | 2014-04-09 Ken Brown <kbrown@cornell.edu> | 5 | 2014-04-09 Ken Brown <kbrown@cornell.edu> |
| 2 | 6 | ||
| 3 | * Makefile.in (EMACS_MANIFEST): Revert last change. | 7 | * Makefile.in (EMACS_MANIFEST): Revert last change. |
diff --git a/src/keyboard.c b/src/keyboard.c index 3b50140684e..f74ba0ee581 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -20,6 +20,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 20 | #include <config.h> | 20 | #include <config.h> |
| 21 | 21 | ||
| 22 | #include "sysstdio.h" | 22 | #include "sysstdio.h" |
| 23 | #include <sys/stat.h> | ||
| 23 | 24 | ||
| 24 | #include "lisp.h" | 25 | #include "lisp.h" |
| 25 | #include "termchar.h" | 26 | #include "termchar.h" |
| @@ -10085,8 +10086,18 @@ This may include sensitive information such as passwords. */) | |||
| 10085 | } | 10086 | } |
| 10086 | if (!NILP (file)) | 10087 | if (!NILP (file)) |
| 10087 | { | 10088 | { |
| 10089 | int fd; | ||
| 10088 | file = Fexpand_file_name (file, Qnil); | 10090 | file = Fexpand_file_name (file, Qnil); |
| 10089 | dribble = emacs_fopen (SSDATA (file), "w"); | 10091 | /* This isn't robust, since eg file could be created after we |
| 10092 | check whether it exists but before emacs_open. | ||
| 10093 | Feel free to improve it, but this is not critical. (Bug#17187) */ | ||
| 10094 | if (! NILP (Ffile_exists_p (file))) | ||
| 10095 | { | ||
| 10096 | if (chmod (SSDATA (file), 0600) < 0) | ||
| 10097 | report_file_error ("Doing chmod", file); | ||
| 10098 | } | ||
| 10099 | fd = emacs_open (SSDATA (file), O_WRONLY | O_CREAT | O_TRUNC, 0600); | ||
| 10100 | dribble = fd < 0 ? 0 : fdopen (fd, "w"); | ||
| 10090 | if (dribble == 0) | 10101 | if (dribble == 0) |
| 10091 | report_file_error ("Opening dribble", file); | 10102 | report_file_error ("Opening dribble", file); |
| 10092 | } | 10103 | } |