aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-02-17 14:28:53 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-02-17 14:28:53 +0000
commitcb448fe01bbe75ef31c3190e8b63b0e1a320ffb4 (patch)
tree9757477193c1b8f3be9a772cabfb1ef92639240e /editors
parentffae845cfd0a0b9872827d806984841d4cfee104 (diff)
downloadbusybox-cb448fe01bbe75ef31c3190e8b63b0e1a320ffb4.tar.gz
libbb: introduce and use xrename and rename_or_warn.
Diffstat (limited to 'editors')
-rw-r--r--editors/patch.c5
-rw-r--r--editors/sed.c3
2 files changed, 2 insertions, 6 deletions
diff --git a/editors/patch.c b/editors/patch.c
index 07fa5cfaf..1b283a133 100644
--- a/editors/patch.c
+++ b/editors/patch.c
@@ -150,10 +150,7 @@ int patch_main(int argc, char **argv)
backup_filename = xmalloc(strlen(new_filename) + 6);
strcpy(backup_filename, new_filename);
strcat(backup_filename, ".orig");
- if (rename(new_filename, backup_filename) == -1) {
- bb_perror_msg_and_die("cannot create file %s",
- backup_filename);
- }
+ xrename(new_filename, backup_filename);
dst_stream = xfopen(new_filename, "w");
}
diff --git a/editors/sed.c b/editors/sed.c
index 433418253..e55bcafc4 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -1340,8 +1340,7 @@ int sed_main(int argc, char **argv)
G.nonstdout = stdout;
/* unlink(argv[i]); */
- // FIXME: error check / message?
- rename(G.outname, argv[i]);
+ xrename(G.outname, argv[i]);
free(G.outname);
G.outname = NULL;
}