changeset 1735:9eebbebbc219

Implement shred -u and switch to default y in defconfig.
author Rob Landley <rob@landley.net>
date Thu, 12 Mar 2015 15:32:50 -0500
parents 03c426368470
children 5892daac85ab
files toys/other/shred.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/toys/other/shred.c	Thu Mar 12 15:16:13 2015 -0500
+++ b/toys/other/shred.c	Thu Mar 12 15:32:50 2015 -0500
@@ -8,7 +8,7 @@
 
 config SHRED
   bool "shred"
-  default n
+  default y
   help
     usage: shred [-fuz] [-n COUNT] [-s SIZE] FILE...
 
@@ -100,5 +100,7 @@
       if (throw != writeall(fd, toybuf, throw)) perror_msg("%s");
       pos += throw;
     }
+    if (toys.optflags & FLAG_u)
+      if (unlink(*try)) perror_msg("unlink '%s'", *try);
   }
 }