summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-03-08 16:57:55 +0000
committerJim Meyering <jim@meyering.net>2003-03-08 16:57:55 +0000
commit34a6d6e2dd0b6c3d9fd83b3ba9861204fc6be83e (patch)
tree2f3bbdb09f2e6c36fe7ae9150578804d40b22552
parent4dffef72e62f2f1c736d7250c3ebb7bdb5fa64c5 (diff)
downloadcoreutils-34a6d6e2dd0b6c3d9fd83b3ba9861204fc6be83e.tar.xz
Before, when using shred on a device, one had to specify --exact,
or be careful to choose a size that would not be rounded up and exceed the maximum value; that could result in a failure of the final write. (do_wipefd): --exact is now the default for non-regular files. Suggestion from Ben Elliston. (usage): Say it.
-rw-r--r--src/shred.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/shred.c b/src/shred.c
index be377b18a..305023b5a 100644
--- a/src/shred.c
+++ b/src/shred.c
@@ -174,7 +174,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\
fputs (_("\
-u, --remove truncate and remove file after overwriting\n\
-v, --verbose show progress\n\
- -x, --exact do not round file sizes up to the next full block\n\
+ -x, --exact do not round file sizes up to the next full block;\n\
+ this is the default for non-regular files\n\
-z, --zero add a final overwrite with zeros to hide shredding\n\
- shred standard output\n\
"), stdout);
@@ -1223,7 +1224,8 @@ do_wipefd (int fd, char const *qname, struct isaac_state *s,
}
}
- if (0 <= size && !(flags->exact))
+ /* Allow `rounding up' only for regular files. */
+ if (0 <= size && !(flags->exact) && S_ISREG (st.st_mode))
{
size += ST_BLKSIZE (st) - 1 - (size - 1) % ST_BLKSIZE (st);