Mercurial > emacs
diff lisp/net/tramp-compat.el @ 107320:d2bfe26756ed
* net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix an
error when FILENAME and NEWNAME are existing remote directories.
* net/tramp-compat.el (tramp-compat-make-temp-file): Add optional
parameter DIR-FLAG.
author | Michael Albinus <michael.albinus@gmx.de> |
---|---|
date | Tue, 02 Mar 2010 10:32:45 +0100 |
parents | 1d1d5d9bd884 |
children | e97568b31550 5a6b4fafaa52 |
line wrap: on
line diff
--- a/lisp/net/tramp-compat.el Tue Mar 02 13:55:33 2010 +0900 +++ b/lisp/net/tramp-compat.el Tue Mar 02 10:32:45 2010 +0100 @@ -215,7 +215,7 @@ ;; has been introduced with Emacs 22. We try it, if it fails, we fall ;; back to `make-temp-name', creating the temporary file immediately ;; in order to avoid a security hole. -(defsubst tramp-compat-make-temp-file (filename) +(defsubst tramp-compat-make-temp-file (filename &optional dir-flag) "Create a temporary file (compat function). Add the extension of FILENAME, if existing." (let* (file-name-handler-alist @@ -226,21 +226,24 @@ result) (condition-case nil (setq result - (funcall (symbol-function 'make-temp-file) prefix nil extension)) + (funcall + (symbol-function 'make-temp-file) prefix dir-flag extension)) (error ;; We use our own implementation, taken from files.el. (while (condition-case () (progn (setq result (concat (make-temp-name prefix) extension)) - (write-region - "" nil result nil 'silent nil - ;; 7th parameter is MUSTBENEW in Emacs, and - ;; CODING-SYSTEM in XEmacs. It is not a security - ;; hole in XEmacs if we cannot use this parameter, - ;; because XEmacs uses a user-specific subdirectory - ;; with 0700 permissions. - (when (not (featurep 'xemacs)) 'excl)) + (if dir-flag + (make-directory result) + (write-region + "" nil result nil 'silent nil + ;; 7th parameter is MUSTBENEW in Emacs, and + ;; CODING-SYSTEM in XEmacs. It is not a security + ;; hole in XEmacs if we cannot use this parameter, + ;; because XEmacs uses a user-specific + ;; subdirectory with 0700 permissions. + (when (not (featurep 'xemacs)) 'excl))) nil) (file-already-exists t)) ;; The file was somehow created by someone else between