From 34a6d6e2dd0b6c3d9fd83b3ba9861204fc6be83e Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 8 Mar 2003 16:57:55 +0000 Subject: [PATCH] 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. --- src/shred.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/shred.c b/src/shred.c index be377b18a6..305023b5a0 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); -- 2.47.3