Article View: gnu.emacs.bug
Article #1129Auto-save in GNU
From: Leigh B. Stoller
Date: Sun, 30 Oct 1988 21:44
Date: Sun, 30 Oct 1988 21:44
60 lines
2010 bytes
2010 bytes
The version is 18.52. The problem is that auto-save creates the new
file with a 666 protection. Instead, it should have the same
protection as the original file. The following a is context diff from
fileio.c. There are better ways to this, but this was easiest.
Leigh
*** /tmp/,RCSt1004274 Sun Oct 30 14:41:33 1988
--- fileio.c Sun Oct 30 14:35:45 1988
***************
*** 71,76 ****
--- 71,80 ----
/* Nonzero during writing of auto-save files */
int auto_saving;
+ /* Set by auto_save_1 to mode of original file so Fwrite_region will create
+ a new file with the same mode as the original */
+ int auto_save_mode_bits;
+
/* Nonzero means, when reading a filename in the minibuffer,
start out by inserting the default directory into the minibuffer. */
int insert_default_directory;
***************
*** 1645,1651 ****
fd = creat (fn, 0666);
}
#else /* not VMS */
! fd = creat (fn, 0666);
#endif /* not VMS */
if (fd < 0)
--- 1649,1659 ----
fd = creat (fn, 0666);
}
#else /* not VMS */
! if (auto_saving)
! fd = creat (fn, auto_save_mode_bits);
! else
! fd = creat (fn, 0666);
!
#endif /* not VMS */
if (fd < 0)
***************
*** 1881,1886 ****
--- 1889,1902 ----
Lisp_Object
auto_save_1 ()
{
+ Lisp_Object filename;
+ unsigned char *fn;
+ struct stat st;
+
+ filename = Fexpand_file_name (bf_cur->name, Qnil);
+ fn = XSTRING (filename)->data;
+ stat (fn, &st);
+ auto_save_mode_bits = st.st_mode;
return
Fwrite_region (Qnil, Qnil,
bf_cur->auto_save_file_name,
Technical Details
Message-ID:
<8810302144.AA04290@cs.utah.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!uunet!tut.cis.ohio-state.edu!CS.UTAH.EDU!stollerShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!uunet!tut.cis.ohio-state.edu!CS.UTAH.EDU!stoller From: stoller@CS.UTAH.EDU (Leigh B. Stoller) Newsgroups: gnu.emacs.bug Subject: Auto-save in GNU Message-ID: <8810302144.AA04290@cs.utah.edu> Date: 30 Oct 88 21:44:22 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 60