[BusyBox] minimally invasive mv-patch

Rainer Weikusat rainer.weikusat at sncag.com
Sun Jul 17 16:37:03 UTC 2005


Below is a patch that fixes the 'mv deletes target despite source
doesn't exist' which has the nice advantage that it does not change
any output except that you don't get an error message if the file that
should not have been deleted could not have been deleted.

------------------------------------------
--- mv.c        30 Nov 2004 16:02:30 -0000      1.1
+++ mv.c        16 Jul 2005 19:57:14 -0000      1.2
@@ -115,7 +115,7 @@
                                                        goto RET_1;
                                                }
                                        }
-                                       if (unlink(dest) < 0) {
+                                       if (source_exists && unlink(dest) < 0) {
                                                bb_perror_msg("cannot remove `%s'", dest);
                                                goto RET_1;
                                        }
------------------------------------------

If you are 'reasonably certain' that no script in your respective
codebase is parsing mv-output, especially the standard 'file not
found' message, the 'offical' one should be fine as well.



More information about the busybox mailing list