[PATCH] patch: don't remove same file twice
Peter Korsgaard
peter.korsgaard at barco.com
Thu Apr 5 12:40:32 UTC 2007
Hi,
patch fails on patches removing files if original and new filename is
the same because the 2nd unlink fails. The following tiny patch fixes
it.
Index: editors/patch.c
===================================================================
--- editors/patch.c (revision 18333)
+++ editors/patch.c (working copy)
@@ -263,7 +263,8 @@
if (unlink(new_filename) == -1) {
bb_perror_msg_and_die("cannot remove file %s", new_filename);
}
- if (unlink(original_filename) == -1) {
+ if (strcmp(new_filename, original_filename)
+ && (unlink(original_filename) == -1)) {
bb_perror_msg_and_die("cannot remove original file %s", new_filename);
}
}
--
Bye, Peter Korsgaard
More information about the busybox
mailing list