diff options
| author | Michael Albinus | 2009-01-06 07:56:42 +0000 |
|---|---|---|
| committer | Michael Albinus | 2009-01-06 07:56:42 +0000 |
| commit | 2c418c5bbfbf2b9feb036f92657471db9567a483 (patch) | |
| tree | 362aaad2bb936713e28519fcbb6265c5656a3fee | |
| parent | 2988341a84f6e5faef7e5f5ce2c55142935d0fee (diff) | |
| download | emacs-2c418c5bbfbf2b9feb036f92657471db9567a483.tar.gz emacs-2c418c5bbfbf2b9feb036f92657471db9567a483.zip | |
* net/tramp-smb.el (tramp-smb-handle-copy-file)
(tramp-smb-handle-rename-file): Delete temporary file in case of
quit.
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/net/tramp-smb.el | 10 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 87 |
3 files changed, 58 insertions, 47 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5267a905bdc..e404bceba07 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2009-01-06 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * net/tramp.el (tramp-do-copy-or-rename-file-directly) | ||
| 4 | (tramp-handle-file-local-copy, tramp-handle-write-region) | ||
| 5 | * net/tramp-smb.el (tramp-smb-handle-copy-file) | ||
| 6 | (tramp-smb-handle-rename-file): Delete temporary file in case of | ||
| 7 | quit. | ||
| 8 | |||
| 1 | 2009-01-06 Stefan Monnier <monnier@iro.umontreal.ca> | 9 | 2009-01-06 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 10 | ||
| 3 | * minibuffer.el (completion-hilit-commonality): Don't presume | 11 | * minibuffer.el (completion-hilit-commonality): Don't presume |
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index b9dc8731215..41f4c25318a 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el | |||
| @@ -218,8 +218,9 @@ PRESERVE-UID-GID is completely ignored." | |||
| 218 | ;; Remote filename. | 218 | ;; Remote filename. |
| 219 | (condition-case err | 219 | (condition-case err |
| 220 | (rename-file tmpfile newname ok-if-already-exists) | 220 | (rename-file tmpfile newname ok-if-already-exists) |
| 221 | (error (delete-file tmpfile) | 221 | ((error quit) |
| 222 | (signal (car err) (cdr err)))) | 222 | (delete-file tmpfile) |
| 223 | (signal (car err) (cdr err)))) | ||
| 223 | 224 | ||
| 224 | ;; Remote newname. | 225 | ;; Remote newname. |
| 225 | (when (file-directory-p newname) | 226 | (when (file-directory-p newname) |
| @@ -554,8 +555,9 @@ PRESERVE-UID-GID is completely ignored." | |||
| 554 | ;; Remote filename. | 555 | ;; Remote filename. |
| 555 | (condition-case err | 556 | (condition-case err |
| 556 | (rename-file tmpfile newname ok-if-already-exists) | 557 | (rename-file tmpfile newname ok-if-already-exists) |
| 557 | (error (delete-file tmpfile) | 558 | ((error quit) |
| 558 | (signal (car err) (cdr err)))) | 559 | (delete-file tmpfile) |
| 560 | (signal (car err) (cdr err)))) | ||
| 559 | 561 | ||
| 560 | ;; Remote newname. | 562 | ;; Remote newname. |
| 561 | (when (file-directory-p newname) | 563 | (when (file-directory-p newname) |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 04781c7b2c2..b226f22ad98 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -3259,52 +3259,53 @@ the uid and gid from FILENAME." | |||
| 3259 | 3259 | ||
| 3260 | ;; We need a temporary file in between. | 3260 | ;; We need a temporary file in between. |
| 3261 | (t | 3261 | (t |
| 3262 | (condition-case err | 3262 | ;; Create the temporary file. |
| 3263 | ;; Create the temporary file. | 3263 | (let ((tmpfile (tramp-compat-make-temp-file localname1))) |
| 3264 | (let ((tmpfile (tramp-compat-make-temp-file localname1))) | 3264 | (condition-case err |
| 3265 | (cond | 3265 | (progn |
| 3266 | (t1 | 3266 | (cond |
| 3267 | (tramp-send-command | 3267 | (t1 |
| 3268 | v (format | 3268 | (tramp-send-command |
| 3269 | "%s %s %s" cmd | 3269 | v (format |
| 3270 | (tramp-shell-quote-argument localname1) | 3270 | "%s %s %s" cmd |
| 3271 | (tramp-shell-quote-argument tmpfile))) | 3271 | (tramp-shell-quote-argument localname1) |
| 3272 | ;; We must change the ownership as remote user. | 3272 | (tramp-shell-quote-argument tmpfile))) |
| 3273 | (tramp-set-file-uid-gid | 3273 | ;; We must change the ownership as remote user. |
| 3274 | (concat prefix tmpfile) | 3274 | (tramp-set-file-uid-gid |
| 3275 | (tramp-get-local-uid 'integer) | 3275 | (concat prefix tmpfile) |
| 3276 | (tramp-get-local-gid 'integer))) | 3276 | (tramp-get-local-uid 'integer) |
| 3277 | (t2 | 3277 | (tramp-get-local-gid 'integer))) |
| 3278 | (if (eq op 'copy) | 3278 | (t2 |
| 3279 | (tramp-compat-copy-file | 3279 | (if (eq op 'copy) |
| 3280 | localname1 tmpfile ok-if-already-exists | 3280 | (tramp-compat-copy-file |
| 3281 | keep-date preserve-uid-gid) | 3281 | localname1 tmpfile ok-if-already-exists |
| 3282 | keep-date preserve-uid-gid) | ||
| 3283 | (tramp-run-real-handler | ||
| 3284 | 'rename-file | ||
| 3285 | (list localname1 tmpfile ok-if-already-exists))) | ||
| 3286 | ;; We must change the ownership as local user. | ||
| 3287 | (tramp-set-file-uid-gid | ||
| 3288 | tmpfile | ||
| 3289 | (tramp-get-remote-uid v 'integer) | ||
| 3290 | (tramp-get-remote-gid v 'integer)))) | ||
| 3291 | |||
| 3292 | ;; Move the temporary file to its destination. | ||
| 3293 | (cond | ||
| 3294 | (t2 | ||
| 3295 | (tramp-send-command | ||
| 3296 | v (format | ||
| 3297 | "mv -f %s %s" | ||
| 3298 | (tramp-shell-quote-argument tmpfile) | ||
| 3299 | (tramp-shell-quote-argument localname2)))) | ||
| 3300 | (t1 | ||
| 3282 | (tramp-run-real-handler | 3301 | (tramp-run-real-handler |
| 3283 | 'rename-file | 3302 | 'rename-file |
| 3284 | (list localname1 tmpfile ok-if-already-exists))) | 3303 | (list tmpfile localname2 ok-if-already-exists))))) |
| 3285 | ;; We must change the ownership as local user. | ||
| 3286 | (tramp-set-file-uid-gid | ||
| 3287 | tmpfile | ||
| 3288 | (tramp-get-remote-uid v 'integer) | ||
| 3289 | (tramp-get-remote-gid v 'integer)))) | ||
| 3290 | |||
| 3291 | ;; Move the temporary file to its destination. | ||
| 3292 | (cond | ||
| 3293 | (t2 | ||
| 3294 | (tramp-send-command | ||
| 3295 | v (format | ||
| 3296 | "mv -f %s %s" | ||
| 3297 | (tramp-shell-quote-argument tmpfile) | ||
| 3298 | (tramp-shell-quote-argument localname2)))) | ||
| 3299 | (t1 | ||
| 3300 | (tramp-run-real-handler | ||
| 3301 | 'rename-file | ||
| 3302 | (list tmpfile localname2 ok-if-already-exists))))) | ||
| 3303 | 3304 | ||
| 3304 | ;; Error handling. | 3305 | ;; Error handling. |
| 3305 | ((error quit) | 3306 | ((error quit) |
| 3306 | (delete-file tmpfile) | 3307 | (delete-file tmpfile) |
| 3307 | (signal (car err) (cdr err))))))))) | 3308 | (signal (car err) (cdr err)))))))))) |
| 3308 | 3309 | ||
| 3309 | ;; Set the time and mode. Mask possible errors. | 3310 | ;; Set the time and mode. Mask possible errors. |
| 3310 | ;; Won't be applied for 'rename. | 3311 | ;; Won't be applied for 'rename. |