mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-19 03:33:43 +03:00
shred: shred one block even for empty files
* src/shred.c (do_wipefd): Shred one block of empty regular files. This reverts an unintended part of the previous change.
This commit is contained in:
1 parent
88545ad025
commit
7c3e6be6d7
1 file changed
+4
-1
+4
-1
@@ -887,8 +887,11 @@ do_wipefd (int fd, char const *qname, struct randint_source *s,
|
||||
|
||||
if (! flags->exact)
|
||||
{
|
||||
/* Round up to the nearest blocksize. If the file is
|
||||
empty output a block anyway, in case the file system
|
||||
stores small files in the inode. */
|
||||
off_t remainder = size % ST_BLKSIZE (st);
|
||||
if (remainder != 0)
|
||||
if (remainder != 0 || size == 0)
|
||||
{
|
||||
off_t size_incr = ST_BLKSIZE (st) - remainder;
|
||||
if (! INT_ADD_OVERFLOW (size, size_incr))
|
||||
|
||||
Reference in new issue
Block a user