aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorMichael Albinus2008-06-11 17:31:02 +0000
committerMichael Albinus2008-06-11 17:31:02 +0000
commit7266b296ed78750915153b61b8fb3cd53eaa2106 (patch)
tree49fb5b2cd806eb956e1c0ab42b63d078c58f4eab /lisp
parent4c808a5caa661d081f5fda8d05e3dc68835316f5 (diff)
downloademacs-7266b296ed78750915153b61b8fb3cd53eaa2106.tar.gz
emacs-7266b296ed78750915153b61b8fb3cd53eaa2106.zip
* net/tramp.el (tramp-make-temp-file): Backport from Tramp 2.1.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/net/tramp.el40
2 files changed, 39 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 58ecb708be7..98c7a540e9f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
12008-06-11 Michael Albinus <michael.albinus@gmx.de>
2
3 * net/tramp.el (tramp-make-temp-file): Backport from Tramp 2.1.
4
12008-06-08 Michael Albinus <michael.albinus@gmx.de> 52008-06-08 Michael Albinus <michael.albinus@gmx.de>
2 6
3 * uniquify.el (uniquify-get-proposed-name): Handle remote files. 7 * uniquify.el (uniquify-get-proposed-name): Handle remote files.
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 5b2c9525b25..14cc6088497 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3779,12 +3779,42 @@ This will break if COMMAND prints a newline, followed by the value of
3779 3779
3780;; File Editing. 3780;; File Editing.
3781 3781
3782;; `make-temp-file' exists in Emacs only. The third parameter SUFFIX
3783;; has been introduced with Emacs 22. We try it, if it fails, we fall
3784;; back to `make-temp-name', creating the temporary file immediately
3785;; in order to avoid a security hole.
3782(defsubst tramp-make-temp-file (filename) 3786(defsubst tramp-make-temp-file (filename)
3783 (concat 3787 "Create a temporary file (compat function).
3784 (funcall (if (fboundp 'make-temp-file) 'make-temp-file 'make-temp-name) 3788Add the extension of FILENAME, if existing."
3785 (expand-file-name tramp-temp-name-prefix 3789 (let* (file-name-handler-alist
3786 (tramp-temporary-file-directory))) 3790 (prefix (expand-file-name
3787 (file-name-extension filename t))) 3791 (symbol-value 'tramp-temp-name-prefix)
3792 (tramp-temporary-file-directory)))
3793 (extension (file-name-extension filename t))
3794 result)
3795 (condition-case nil
3796 (setq result
3797 (funcall (symbol-function 'make-temp-file) prefix nil extension))
3798 (error
3799 ;; We use our own implementation, taken from files.el.
3800 (while
3801 (condition-case ()
3802 (progn
3803 (setq result (concat (make-temp-name prefix) extension))
3804 (write-region
3805 "" nil result nil 'silent nil
3806 ;; 7th parameter is MUSTBENEW in Emacs, and
3807 ;; CODING-SYSTEM in XEmacs. It is not a security
3808 ;; hole in XEmacs if we cannot use this parameter,
3809 ;; because XEmacs uses a user-specific subdirectory
3810 ;; with 0700 permissions.
3811 (when (not (featurep 'xemacs)) 'excl))
3812 nil)
3813 (file-already-exists t))
3814 ;; The file was somehow created by someone else between
3815 ;; `make-temp-name' and `write-region', let's try again.
3816 nil)))
3817 result))
3788 3818
3789(defun tramp-handle-file-local-copy (filename) 3819(defun tramp-handle-file-local-copy (filename)
3790 "Like `file-local-copy' for tramp files." 3820 "Like `file-local-copy' for tramp files."