changeset 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 99266150cba5
children e5795c848893
files src/fileio.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
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));