bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: coreutils-5.2.1 shred minor error


From: Paul Eggert
Subject: Re: coreutils-5.2.1 shred minor error
Date: Fri, 04 Jun 2004 00:40:18 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Jon Peatfield <address@hidden> writes:

> However at the end of the loop it still does soff += ssize (the return
> from the write()), which moves us to no longer being block aligned so
> at the 2nd "error", it fails to skip the block and instead errors out.

Thanks for spotting this bug and proposing a patch.  Here's an
alternative (slightly simpler) patch.  This patch is relative to
coreutils CVS.

2004-06-04  Paul Eggert  <address@hidden>

        * src/shred.c (dopass): Don't subtract 1 from the offset after
        a write error.  Problem reported by Jon Peatfield in:
        http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00020.html

Index: shred.c
===================================================================
RCS file: /home/meyering/coreutils/cu/src/shred.c,v
retrieving revision 1.94
diff -p -u -r1.94 shred.c
--- shred.c     30 May 2004 08:43:35 -0000      1.94
+++ shred.c     4 Jun 2004 07:33:28 -0000
@@ -921,7 +921,7 @@ dopass (int fd, char const *qname, off_t
                      if (lseek (fd, (off_t) (offset + soff + 512), SEEK_SET)
                          != -1)
                        {
-                         soff += 512;
+                         ssize = 512;
                          write_error = true;
                          continue;
                        }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]