summaryrefslogtreecommitdiffhomepage
path: root/coreutils
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2021-06-20 13:48:21 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2021-06-20 13:48:21 +0200
commitd71c7892ac56939cfcf3fa699ee8b0195631ee5a (patch)
tree4213daa98f96c8b802a90745befec33cf3803e6d /coreutils
parentec3170ac9578d4a42423e5a966a8ba668df68337 (diff)
shred: with -u, unlink file even if it is zero length
function old new delta shred_main 391 387 -4 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/shred.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/coreutils/shred.c b/coreutils/shred.c
index 4b95d197c..04bf87229 100644
--- a/coreutils/shred.c
+++ b/coreutils/shred.c
@@ -99,12 +99,12 @@ int shred_main(int argc UNUSED_PARAM, char **argv)
bb_copyfd_size(zero_fd, fd, size);
fdatasync(fd);
}
- if (opt & OPT_u) {
- ftruncate(fd, 0);
- xunlink(fname);
- }
- xclose(fd);
}
+ if (opt & OPT_u) {
+ ftruncate(fd, 0);
+ xunlink(fname);
+ }
+ xclose(fd);
}
return EXIT_SUCCESS;