]> git.eshelyaron.com Git - emacs.git/commitdiff
* net/tramp-smb.el (tramp-smb-handle-copy-file)
authorMichael Albinus <michael.albinus@gmx.de>
Mon, 5 Jan 2009 19:40:55 +0000 (19:40 +0000)
committerMichael Albinus <michael.albinus@gmx.de>
Mon, 5 Jan 2009 19:40:55 +0000 (19:40 +0000)
(tramp-smb-handle-rename-file, tramp-smb-handle-write-region):
Delete temporary file in case of error.

lisp/ChangeLog
lisp/net/tramp-smb.el

index 1437ddeed072981040ae99a6c5932665ac882ada..1009a3812229e3aa411e2daf623993340f07a966 100644 (file)
@@ -1,3 +1,13 @@
+2009-01-05  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-handle-load)
+       (tramp-do-copy-or-rename-file-directly)
+       (tramp-handle-file-local-copy, tramp-handle-insert-file-contents)
+       (tramp-handle-write-region)
+       * net/tramp-smb.el (tramp-smb-handle-copy-file)
+       (tramp-smb-handle-rename-file, tramp-smb-handle-write-region):
+       Delete temporary file in case of error.
+
 2009-01-05  Agustín Martín <agustin.martin@hispalinux.es>
 
        * textmodes/ispell.el (ispell-check-version): Use (with-temp-buffer)
index 4ce8aa7fce6118438a5bb1d8e9ba563c05c92ac8..b9dc8731215d54413c727262813f115494f1a519 100644 (file)
@@ -216,7 +216,10 @@ PRESERVE-UID-GID is completely ignored."
 
     (if tmpfile
        ;; Remote filename.
-       (rename-file tmpfile newname ok-if-already-exists)
+       (condition-case err
+           (rename-file tmpfile newname ok-if-already-exists)
+         (error (delete-file tmpfile)
+                (signal (car err) (cdr err))))
 
       ;; Remote newname.
       (when (file-directory-p newname)
@@ -548,10 +551,13 @@ PRESERVE-UID-GID is completely ignored."
   (let ((tmpfile (file-local-copy filename)))
 
     (if tmpfile
-       ;; remote filename
-       (rename-file tmpfile newname ok-if-already-exists)
+       ;; Remote filename.
+       (condition-case err
+           (rename-file tmpfile newname ok-if-already-exists)
+         (error (delete-file tmpfile)
+                (signal (car err) (cdr err))))
 
-      ;; remote newname
+      ;; Remote newname.
       (when (file-directory-p newname)
        (setq newname (expand-file-name
                      (file-name-nondirectory filename) newname)))
@@ -618,12 +624,13 @@ errors for shares like \"C$/\", which are common in Microsoft Windows."
         (list start end tmpfile append 'no-message lockname)))
 
       (tramp-message v 5 "Writing tmp file %s to file %s..." tmpfile filename)
-      (if (tramp-smb-send-command v (format "put %s \"%s\"" tmpfile file))
-         (tramp-message
-          v 5 "Writing tmp file %s to file %s...done" tmpfile filename)
-       (tramp-error v 'file-error "Cannot write `%s'" filename))
+      (unwind-protect
+         (if (tramp-smb-send-command v (format "put %s \"%s\"" tmpfile file))
+             (tramp-message
+              v 5 "Writing tmp file %s to file %s...done" tmpfile filename)
+           (tramp-error v 'file-error "Cannot write `%s'" filename))
+       (delete-file tmpfile))
 
-      (delete-file tmpfile)
       (unless (equal curbuf (current-buffer))
        (tramp-error
         v 'file-error