Don't remove target in mcopy master
authorRobert Pengelly <robertapengelly@hotmail.com>
Tue, 24 Sep 2024 15:42:56 +0000 (16:42 +0100)
committerRobert Pengelly <robertapengelly@hotmail.com>
Tue, 24 Sep 2024 15:42:56 +0000 (16:42 +0100)
mcopy.c

diff --git a/mcopy.c b/mcopy.c
index ef21690c8d7f9e79380a767fde99e8acd1011292..0c92b040273698ba37cfc98b4a39bf3ead728a2e 100644 (file)
--- a/mcopy.c
+++ b/mcopy.c
@@ -1832,8 +1832,6 @@ int copy_from_image (const char *target, struct file_info *fi, const char *fname
             if (seekto (sector * 512) || fread (fi->scratch, 512, 1, ofp) != 1) {
             
                 fclose (tfp);
             if (seekto (sector * 512) || fread (fi->scratch, 512, 1, ofp) != 1) {
             
                 fclose (tfp);
-                remove (target);
-                
                 return -1;
             
             }
                 return -1;
             
             }
@@ -1843,8 +1841,6 @@ int copy_from_image (const char *target, struct file_info *fi, const char *fname
                 if (fwrite (fi->scratch, 512, 1, tfp) != 1) {
                 
                     fclose (tfp);
                 if (fwrite (fi->scratch, 512, 1, tfp) != 1) {
                 
                     fclose (tfp);
-                    remove (target);
-                    
                     return -1;
                 
                 }
                     return -1;
                 
                 }
@@ -1865,8 +1861,6 @@ int copy_from_image (const char *target, struct file_info *fi, const char *fname
                 if (fwrite (fi->scratch, fi->bytes, 1, tfp) != 1) {
                 
                     fclose (tfp);
                 if (fwrite (fi->scratch, fi->bytes, 1, tfp) != 1) {
                 
                     fclose (tfp);
-                    remove (target);
-                    
                     return -1;
                 
                 }
                     return -1;
                 
                 }
@@ -2209,8 +2203,6 @@ int main (int argc, char **argv) {
             if (memcmp (source, "::", 2)) {
         
                 fclose (ofp);
             if (memcmp (source, "::", 2)) {
         
                 fclose (ofp);
-                remove (state->outfile);
-                
                 print_help (EXIT_FAILURE);
             
             }
                 print_help (EXIT_FAILURE);
             
             }