Two bugfixes for deleting files (-p and message)
authorRob Landley <rob@landley.net>
Tue, 16 Dec 2008 07:48:27 +0000 (01:48 -0600)
committerRob Landley <rob@landley.net>
Tue, 16 Dec 2008 07:48:27 +0000 (01:48 -0600)
toys/patch.c

index b1f8d41..6299653 100644 (file)
@@ -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);