summaryrefslogtreecommitdiff
path: root/src/shred.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-04-19 02:13:01 +0000
committerJim Meyering <jim@meyering.net>1999-04-19 02:13:01 +0000
commitd70fb569fb3420e182fb650470b31c3d7e6fdc7b (patch)
tree340e1e7a52286df30073c13612b76e04262eccd1 /src/shred.c
parente5e1c6d4fd10baf10d670204212f5c57a299cd11 (diff)
downloadcoreutils-d70fb569fb3420e182fb650470b31c3d7e6fdc7b.tar.xz
[!HAVE_CONFIG_H] (ST_BLKSIZE): Define to 65536.
(do_wipefd): Use ST_BLKSIZE instead of referring to the st_blksize member directly.
Diffstat (limited to 'src/shred.c')
-rw-r--r--src/shred.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/shred.c b/src/shred.c
index 2c48fd7c3..922ccefb5 100644
--- a/src/shred.c
+++ b/src/shred.c
@@ -151,6 +151,10 @@ char *xstrdup PARAMS ((char const *));
# endif
# endif
+/* POSIX doesn't require st_blksize, and 65536 is a reasonable
+ upper bound for existing filesystem practice. */
+# define ST_BLKSIZE(Stat) 65536
+
# define uintmax_t unsigned long
/* Variant human-readable function that ignores last two args */
@@ -1418,9 +1422,9 @@ do_wipefd (int fd, char const *qname, struct isaac_state *s,
error (0, 0, _("%s: file has negative size"), qname);
return -1;
}
- if (0 <= size && st.st_blksize && !(flags->exact))
+ if (0 <= size && !(flags->exact))
{
- size += st.st_blksize - 1 - (size - 1) % st.st_blksize;
+ size += ST_BLKSIZE (st) - 1 - (size - 1) % ST_BLKSIZE (st);
if (size < 0)
size = TYPE_MAXIMUM (off_t);
}