summaryrefslogtreecommitdiff
path: root/lisp/gnus/nnmail.el
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2020-02-26 17:10:21 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2020-02-26 17:10:48 -0800
commit07da629926daf849aab248175c88cf53a5e21558 (patch)
treea2d84bbae86d34d0ee4c9d9e535ff5aef2aee5bc /lisp/gnus/nnmail.el
parent3766bf728a43933083f4525970bcf9fdace3838d (diff)
downloademacs-07da629926daf849aab248175c88cf53a5e21558.tar.gz
nnmail-cache-close should not use nofollow
nnmail-cache-close did not work when ~/.nnmail-cache was a symlink to some other directory. Reported by Michael Albinus (Bug#39793). * lisp/gnus/nnbabyl.el (nnbabyl-create-mbox): * lisp/gnus/nndiary.el (nndiary-generate-nov-file): * lisp/gnus/nnfolder.el (nnfolder-possibly-change-group): * lisp/gnus/nnmbox.el (nnmbox-create-mbox): * lisp/gnus/nnml.el (nnml-generate-nov-file): Pass ‘excl’ to nnmail-write-region when creating a file, for safety. * lisp/gnus/nnmail.el (nnmail-write-region): Add optional MUSTBENEW arg, to stay consistent with write-region. Past ‘nofollow’ to set-file-modes only when MUSTBENEW is ‘excl’.
Diffstat (limited to 'lisp/gnus/nnmail.el')
-rw-r--r--lisp/gnus/nnmail.el8
1 files changed, 5 insertions, 3 deletions
diff --git a/lisp/gnus/nnmail.el b/lisp/gnus/nnmail.el
index 93e4b0e7a8f..3be843c91f1 100644
--- a/lisp/gnus/nnmail.el
+++ b/lisp/gnus/nnmail.el
@@ -1953,12 +1953,14 @@ If TIME is nil, then return the cutoff time for oldness instead."
(unless (re-search-forward "^Message-ID[ \t]*:" nil t)
(insert "Message-ID: " (nnmail-message-id) "\n")))))
-(defun nnmail-write-region (start end filename &optional append visit lockname)
+(defun nnmail-write-region (start end filename
+ &optional append visit lockname mustbenew)
"Do a `write-region', and then set the file modes."
(let ((coding-system-for-write nnmail-file-coding-system)
(file-name-coding-system nnmail-pathname-coding-system))
- (write-region start end filename append visit lockname)
- (set-file-modes filename nnmail-default-file-modes 'nofollow)))
+ (write-region start end filename append visit lockname mustbenew)
+ (set-file-modes filename nnmail-default-file-modes
+ (when (eq mustbenew 'excl) 'nofollow))))
;;;
;;; Status functions