summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/autoload.el
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-09-16 17:43:56 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2019-09-16 18:00:59 -0700
commitbc1c2cf009e30af77523fd87a8910fdbc4284704 (patch)
treee825b2ac67c0beb3b43f50ec100eed4c0d93570b /lisp/emacs-lisp/autoload.el
parentb124cb8f30d575fcda97507c40f16a499640bcd5 (diff)
downloademacs-bc1c2cf009e30af77523fd87a8910fdbc4284704.tar.gz
Fix some file-mode races
* lisp/emacs-lisp/autoload.el (autoload-ensure-file-writeable): * lisp/files.el (after-find-file): * lisp/gnus/gnus-start.el (gnus-dribble-read-file): * lisp/htmlfontify.el (hfy-copy-and-fontify-file): * lisp/server.el (server-ensure-safe-dir): Avoid a race when getting file permissions.
Diffstat (limited to 'lisp/emacs-lisp/autoload.el')
-rw-r--r--lisp/emacs-lisp/autoload.el3
1 files changed, 1 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el
index a2dbd402c52..ce2827162b9 100644
--- a/lisp/emacs-lisp/autoload.el
+++ b/lisp/emacs-lisp/autoload.el
@@ -398,9 +398,8 @@ FILE's name."
;; Probably pointless, but replaces the old AUTOGEN_VCS in lisp/Makefile,
;; which was designed to handle CVSREAD=1 and equivalent.
(and autoload-ensure-writable
- (file-exists-p file)
(let ((modes (file-modes file)))
- (if (zerop (logand modes #o0200))
+ (if (and modes (zerop (logand modes #o0200)))
;; Ignore any errors here, and let subsequent attempts
;; to write the file raise any real error.
(ignore-errors (set-file-modes file (logior modes #o0200))))))