File 04_error_on_copymove_over_fish.patch of Package mc

diff --git a/vfs/fish.c b/vfs/fish.c
index d03917e..e0e4471 100644
--- a/vfs/fish.c
+++ b/vfs/fish.c
@@ -536,6 +536,7 @@ fish_file_store(struct vfs_class *me, struct vfs_s_fh *fh, char *name, char *loc
 	n = fish_command (me, super, WAIT_REPLY,
 		 "#STOR %lu \"/%s\"\n"
 		 "echo '### 001'\n"
+         "if touch \"/%s\"; then\n"
 		 "file=\"/%s\"\n"
                  "res=`exec 3>&1\n"
 		 "(\n"
@@ -552,14 +553,18 @@ fish_file_store(struct vfs_class *me, struct vfs_s_fh *fh, char *name, char *loc
 			"    n=`dd bs=256 count=$cnt | tee -a \"$file\" | wc -c`\n"
 			"    rest=`expr $rest - $n`\n"
 			"done\n"
-		 "}; echo '### 200'\n",
-		 (unsigned long) s.st_size, name,
+		    "}; echo '### 200'\n"
+         "else\n"
+            "echo '### 500'\n"
+         "fi\n",
+		 (unsigned long) s.st_size, name, name,
 		 quoted_name, (unsigned long) s.st_size,
 		 (unsigned long) s.st_size);
     else
 	n = fish_command (me, super, WAIT_REPLY,
 		 "#STOR %lu \"/%s\"\n"
 		 "echo '### 001'\n"
+         "if touch \"/%s\"; then\n"
 		 "{\n"
 			"file=\"/%s\"\n"
 			"rest=%lu\n"
@@ -570,7 +575,10 @@ fish_file_store(struct vfs_class *me, struct vfs_s_fh *fh, char *name, char *loc
 			"    rest=`expr $rest - $n`\n"
 			"done\n"
 		 "}; echo '### 200'\n",
-		 (unsigned long) s.st_size, name,
+         "else\n"
+            "echo '### 500'\n"
+         "fi\n",
+		 (unsigned long) s.st_size, name, name,
 		 quoted_name, (unsigned long) s.st_size);
 
     g_free (quoted_name);
openSUSE Build Service is sponsored by