[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/1] * tramp.el (tramp-handle-write-region): Avoid tramp-set-file
From: |
Julian Scheid |
Subject: |
[PATCH 1/1] * tramp.el (tramp-handle-write-region): Avoid tramp-set-file-uid-gid if file-attributes shows uid/gid to be set already. |
Date: |
Sat, 15 Aug 2009 18:02:46 +1200 |
---
lisp/ChangeLog | 6 ++++++
lisp/tramp.el | 19 ++++++++++++-------
2 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d52781c..4897fba 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2009-08-15 Julian Scheid <address@hidden>
+
+ * tramp.el (tramp-handle-write-region): Avoid
+ tramp-set-file-uid-gid if file-attributes shows uid/gid to be set
+ already.
+
2009-08-14 Michael Albinus <address@hidden>
* tramp.el (tramp-message-show-message): New defvar.
diff --git a/lisp/tramp.el b/lisp/tramp.el
index 1ecae2c..950b3aa 100644
--- a/lisp/tramp.el
+++ b/lisp/tramp.el
@@ -4740,17 +4740,22 @@ Returns a file name in `tramp-auto-save-directory' for
autosaving this file."
;; We must protect `last-coding-system-used', now we have set it
;; to its correct value.
- (let (last-coding-system-used)
+ (let (last-coding-system-used (need-chown t))
;; Set file modification time.
(when (or (eq visit t) (stringp visit))
- (set-visited-file-modtime
- ;; We must pass modtime explicitely, because filename can
- ;; be different from (buffer-file-name), f.e. if
- ;; `file-precious-flag' is set.
- (nth 5 (file-attributes filename))))
+ (let ((file-attr (file-attributes filename)))
+ (set-visited-file-modtime
+ ;; We must pass modtime explicitely, because filename can
+ ;; be different from (buffer-file-name), f.e. if
+ ;; `file-precious-flag' is set.
+ (nth 5 file-attr))
+ (when (and (eq (nth 2 file-attr) uid)
+ (eq (nth 3 file-attr) gid))
+ (setq need-chown nil))))
;; Set the ownership.
- (tramp-set-file-uid-gid filename uid gid)
+ (when need-chown
+ (tramp-set-file-uid-gid filename uid gid))
(when (or (eq visit t) (null visit) (stringp visit))
(tramp-message v 0 "Wrote %s" filename))
(run-hooks 'tramp-handle-write-region-hook)))))
--
1.6.4