changeset 331:9de39991c080

Two bugfixes for deleting files (-p and message)
author Rob Landley <rob@landley.net>
date Tue, 16 Dec 2008 01:48:27 -0600
parents 2a003d86d805
children d3f85181d882
files toys/patch.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/toys/patch.c	Sun Dec 14 02:12:07 2008 -0600
+++ b/toys/patch.c	Tue Dec 16 01:48:27 2008 -0600
@@ -270,9 +270,11 @@
 				}
 			}
 
-			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);