emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-24 r116936: * src/keyboard.c (Fopen_dribble_file): M


From: Glenn Morris
Subject: [Emacs-diffs] emacs-24 r116936: * src/keyboard.c (Fopen_dribble_file): Make file private.
Date: Fri, 11 Apr 2014 05:47:40 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116936
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/17187
committer: Glenn Morris <address@hidden>
branch nick: emacs-24
timestamp: Thu 2014-04-10 22:47:32 -0700
message:
  * src/keyboard.c (Fopen_dribble_file): Make file private.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/keyboard.c                 keyboard.c-20091113204419-o5vbwnq5f7feedwu-449
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-04-09 21:16:37 +0000
+++ b/src/ChangeLog     2014-04-11 05:47:32 +0000
@@ -1,3 +1,7 @@
+2014-04-11  Glenn Morris  <address@hidden>
+
+       * keyboard.c (Fopen_dribble_file): Make file private.  (Bug#17187)
+
 2014-04-09  Ken Brown  <address@hidden>
 
        * Makefile.in (EMACS_MANIFEST): Revert last change.

=== modified file 'src/keyboard.c'
--- a/src/keyboard.c    2014-04-05 18:33:55 +0000
+++ b/src/keyboard.c    2014-04-11 05:47:32 +0000
@@ -20,6 +20,7 @@
 #include <config.h>
 
 #include "sysstdio.h"
+#include <sys/stat.h>
 
 #include "lisp.h"
 #include "termchar.h"
@@ -10085,8 +10086,18 @@
     }
   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);
     }


reply via email to

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