diff src/fileio.c @ 98276:75edb944833f

(Frename_file): Avoid copying to trash if a rename involves a delete. (Bug#964).
author Glenn Morris <rgm@gnu.org>
date Sat, 20 Sep 2008 21:40:54 +0000
parents 934c5bd94a4b
children 29ea4287708c
line wrap: on
line diff
--- a/src/fileio.c	Sat Sep 20 21:29:03 2008 +0000
+++ b/src/fileio.c	Sat Sep 20 21:40:54 2008 +0000
@@ -2231,6 +2231,7 @@
     {
       if (errno == EXDEV)
 	{
+          int count;
 #ifdef S_IFLNK
           symlink_target = Ffile_symlink_p (file);
           if (! NILP (symlink_target))
@@ -2244,7 +2245,10 @@
 			NILP (ok_if_already_exists) ? Qnil : Qt,
 			Qt, Qt);
 
+	  count = SPECPDL_INDEX ();
+	  specbind (intern ("delete-by-moving-to-trash"), Qnil);
 	  Fdelete_file (file);
+	  unbind_to (count, Qnil);
 	}
       else
 	report_file_error ("Renaming", list2 (file, newname));