diff options
author | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-04-05 21:25:15 +0000 |
---|---|---|
committer | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-04-05 21:25:15 +0000 |
commit | 357448c46daec12f0dd7dfa12f1f2f1c1e89fed8 (patch) | |
tree | a638c7bbef95bd2c9d72c2e16a5cf4f7b6298458 /editors | |
parent | 64f50236a404495280375c8e078301c1749a148a (diff) | |
download | busybox-w32-357448c46daec12f0dd7dfa12f1f2f1c1e89fed8.tar.gz busybox-w32-357448c46daec12f0dd7dfa12f1f2f1c1e89fed8.tar.bz2 busybox-w32-357448c46daec12f0dd7dfa12f1f2f1c1e89fed8.zip |
libbb: add xunlink()
patch: do not try to delete same file twice
git-svn-id: svn://busybox.net/trunk/busybox@18342 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'editors')
-rw-r--r-- | editors/patch.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/editors/patch.c b/editors/patch.c index 2c908040f..4d1425edc 100644 --- a/editors/patch.c +++ b/editors/patch.c | |||
@@ -260,12 +260,9 @@ int patch_main(int argc, char **argv) | |||
260 | } | 260 | } |
261 | if ((dest_cur_line == 0) || (dest_beg_line == 0)) { | 261 | if ((dest_cur_line == 0) || (dest_beg_line == 0)) { |
262 | /* The new patched file is empty, remove it */ | 262 | /* The new patched file is empty, remove it */ |
263 | if (unlink(new_filename) == -1) { | 263 | xunlink(new_filename); |
264 | bb_perror_msg_and_die("cannot remove file %s", new_filename); | 264 | if (strcmp(new_filename, original_filename) != 0) |
265 | } | 265 | xunlink(original_filename); |
266 | if (unlink(original_filename) == -1) { | ||
267 | bb_perror_msg_and_die("cannot remove original file %s", new_filename); | ||
268 | } | ||
269 | } | 266 | } |
270 | } | 267 | } |
271 | } | 268 | } |