From 546ead6f4068611b7504baae1bf678d8b0b22942 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Tue, 16 Dec 2008 01:48:27 -0600 Subject: Two bugfixes for deleting files (-p and message) --- toys/patch.c | 6 ++++-- 1 file 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); -- cgit v1.2.3