+2014-04-11 Glenn Morris <rgm@gnu.org>
+
+ * keyboard.c (Fopen_dribble_file): Make file private. (Bug#17187)
+
2014-04-09 Ken Brown <kbrown@cornell.edu>
* Makefile.in (EMACS_MANIFEST): Revert last change.
#include <config.h>
#include "sysstdio.h"
+#include <sys/stat.h>
#include "lisp.h"
#include "termchar.h"
}
if (!NILP (file))
{
+ int fd;
file = Fexpand_file_name (file, Qnil);
- dribble = emacs_fopen (SSDATA (file), "w");
+ /* This isn't robust, since eg file could be created after we
+ check whether it exists but before emacs_open.
+ Feel free to improve it, but this is not critical. (Bug#17187) */
+ if (! NILP (Ffile_exists_p (file)))
+ {
+ if (chmod (SSDATA (file), 0600) < 0)
+ report_file_error ("Doing chmod", file);
+ }
+ fd = emacs_open (SSDATA (file), O_WRONLY | O_CREAT | O_TRUNC, 0600);
+ dribble = fd < 0 ? 0 : fdopen (fd, "w");
if (dribble == 0)
report_file_error ("Opening dribble", file);
}