emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp/net tramp.el


From: Michael Albinus
Subject: [Emacs-diffs] emacs/lisp/net tramp.el
Date: Sun, 08 Nov 2009 10:44:23 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Michael Albinus <albinus>       09/11/08 10:44:23

Modified files:
        lisp/net       : tramp.el 

Log message:
        * net/tramp.el (tramp-advice-make-auto-save-file-name)
        (tramp-advice-file-expand-wildcards): Unload via
        `ad-remove-advice'.
        
        * net/tramp.el (tramp-advice-file-expand-wildcards): Don't rely on
        `ad-do-it'.
        
        * net/tramp.el (tramp-handle-write-region): Copy but rename temp file,
        in order to keep context in SELinux.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/net/tramp.el?cvsroot=emacs&r1=1.265&r2=1.266

Patches:
Index: tramp.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/tramp.el,v
retrieving revision 1.265
retrieving revision 1.266
diff -u -b -r1.265 -r1.266
--- tramp.el    7 Nov 2009 23:52:48 -0000       1.265
+++ tramp.el    8 Nov 2009 10:44:22 -0000       1.266
@@ -4927,22 +4927,25 @@
           ((or (tramp-local-host-p v)
                (tramp-method-out-of-band-p
                 v (- (or end (point-max)) (or start (point-min)))))
-           (condition-case err
                (if (and (= (or end (point-max)) (point-max))
                         (= (or start (point-min)) (point-min))
                         (tramp-get-method-parameter
                          method 'tramp-copy-keep-tmpfile))
                    (progn
+                 (setq tramp-temp-buffer-file-name tmpfile)
+                 (condition-case err
                      ;; We keep the local file for performance
                      ;; reasons, useful for "rsync".
-                     (setq tramp-temp-buffer-file-name tmpfile)
-                     (copy-file tmpfile filename t))
-                 (setq tramp-temp-buffer-file-name nil)
-                 (rename-file tmpfile filename t))
+                     (copy-file tmpfile filename t)
              ((error quit)
               (setq tramp-temp-buffer-file-name nil)
               (delete-file tmpfile)
               (signal (car err) (cdr err)))))
+             (setq tramp-temp-buffer-file-name nil)
+             ;; Don't rename, in order to keep context in SELinux.
+             (unwind-protect
+                 (copy-file tmpfile filename t)
+               (delete-file tmpfile))))
 
           ;; Use inline file transfer.
           (rem-dec
@@ -8123,8 +8126,12 @@
        (setq ad-return-value
              (tramp-file-name-handler 'make-auto-save-file-name))
       ad-do-it))
-  (add-hook 'tramp-unload-hook
-           (lambda () (ad-unadvise 'make-auto-save-file-name))))
+  (add-hook
+   'tramp-unload-hook
+   (lambda ()
+     (ad-remove-advice
+      'make-auto-save-file-name
+      'around 'tramp-advice-make-auto-save-file-name))))
 
 ;; In Emacs < 22 and XEmacs < 21.5 autosaved remote files have
 ;; permission 0666 minus umask. This is a security threat.
@@ -8356,12 +8363,20 @@
          (if (string-match
               "[[*?]"
               (tramp-file-name-localname (tramp-dissect-file-name name)))
-             (setq ad-return-value (or ad-do-it (list name)))
+             (progn
+               ad-do-it
+               (unless ad-return-value
+                 (setq ad-return-value (list name))))
            (setq ad-return-value (list name)))
        ;; If it is not a Tramp file, just run the original function.
-       (setq ad-return-value (or ad-do-it (list name))))))
-  (add-hook 'tramp-unload-hook
-           (lambda () (ad-unadvise 'file-expand-wildcards))))
+       ad-do-it
+       (unless ad-return-value
+         (setq ad-return-value (list name))))))
+  (add-hook
+   'tramp-unload-hook
+   (lambda ()
+     (ad-remove-advice
+      'file-expand-wildcards 'around 'tramp-advice-file-expand-wildcards))))
 
 ;; Checklist for `tramp-unload-hook'
 ;; - Unload all `tramp-*' packages




reply via email to

[Prev in Thread] Current Thread [Next in Thread]