aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2008-12-16 01:48:27 -0600
committerRob Landley <rob@landley.net>2008-12-16 01:48:27 -0600
commit546ead6f4068611b7504baae1bf678d8b0b22942 (patch)
treeb0ef8b4cedacd9f80cf1fb61b467040e332a5d76
parentcca44505f242e215c7b84cbad0a04d9fc64df899 (diff)
downloadtoybox-546ead6f4068611b7504baae1bf678d8b0b22942.tar.gz
Two bugfixes for deleting files (-p and message)
-rw-r--r--toys/patch.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/toys/patch.c b/toys/patch.c
index b1f8d413..62996538 100644
--- a/toys/patch.c
+++ b/toys/patch.c
@@ -270,9 +270,11 @@ void patch_main(void)
}
}
- if (del) xunlink(TT.oldname);
+ if (del) {
+ printf("removing %s\n", start);
+ xunlink(start);
// If we've got a file to open, do so.
- else if (!(toys.optflags & FLAG_PATHLEN) || i <= TT.prefix) {
+ } else if (!(toys.optflags & FLAG_PATHLEN) || i <= TT.prefix) {
// If the old file was null, we're creating a new one.
if (!strcmp(TT.oldname, "/dev/null")) {
printf("creating %s\n", start);