From 07da629926daf849aab248175c88cf53a5e21558 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 26 Feb 2020 17:10:21 -0800 Subject: nnmail-cache-close should not use nofollow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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’. --- lisp/gnus/nnmail.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lisp/gnus/nnmail.el') 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 -- cgit v1.2.1