From e74f1bb6f82eef5bc4909f25b5c10d8e7bffc090 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Thu, 22 Sep 2011 12:00:07 +0200 Subject: [PATCH] * files.el (copy-directory): Set directory attributes only in case they could be retrieved from the source directory. (Bug#9565) --- lisp/ChangeLog | 5 +++++ lisp/files.el | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 17000ca8697..013df43f3b7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2011-09-22 Michael Albinus + + * files.el (copy-directory): Set directory attributes only in case + they could be retrieved from the source directory. (Bug#9565) + 2011-09-22 Dima Kogan (tiny change) * progmodes/hideshow.el (hs-looking-at-block-start-p) diff --git a/lisp/files.el b/lisp/files.el index b29c0596d7b..8b05b62e524 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -4941,9 +4941,10 @@ directly into NEWNAME instead." (copy-file file target t keep-time))))) ;; Set directory attributes. - (set-file-modes newname (file-modes directory)) - (if keep-time - (set-file-times newname (nth 5 (file-attributes directory))))))) + (let ((modes (file-modes directory)) + (times (and keep-time (nth 5 (file-attributes directory))))) + (if modes (set-file-modes newname modes)) + (if times (set-file-times newname times)))))) (put 'revert-buffer-function 'permanent-local t) (defvar revert-buffer-function nil -- 2.39.5