bug-coreutils
[Top][All Lists]
Advanced

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

Re: fdatasync() error in shred from coreutils-5.2.1 on AIX 5.2


From: Jim Meyering
Subject: Re: fdatasync() error in shred from coreutils-5.2.1 on AIX 5.2
Date: Mon, 17 May 2004 14:44:52 +0200

Jim Meyering <address@hidden> wrote:
>> 2004-05-15  Paul Eggert  <address@hidden>
>>
>>      In shred, check for errors from fdatasync more carefully.  If
>>      fdatasync fails with errno==EINVAL, it means this implementation
>>      does not support synchronized I/O for this file.  Do not report
>>      this as an error, as (for example) AIX 5.2 fdatasync reports it
>>      for raw disk devices.  Problem reported by Albert Chin in
>>      <http://mail.gnu.org/archive/html/bug-gnu-utils/2004-05/msg00028.html>.
>>
>>      Check for write errors, though: the old code ignored them.
>>      Improve error checking in a few other cases, too (e.g., close of a
>>      directory).
>>
>>      Also, change several 'int' values to 'bool', so that the error
>>      checking is a bit clearer.  Similarly, change unsigned values
>>      to size_t where appropriate.
>>
>>      * src/shred.c: Include "dirname.h".
...
>>      (incname): Return bool (true/false), not int (0/1).  Accept
>>      size_t length, not unsigned.  All callers changed.  Do not
>>      bother checking for non-digits; it can't happen.  Replace
>>      recursion with iteration.
...

Thanks again.
I've just made an additional change:

        * src/shred.c (incname): Decrement `len' only once per loop iteration.

Otherwise, this would make shred segfault:

  touch f 0 && shred --verbose -u f

By the way, regarding this change:

>>      (names): Use only digits and uppercase letters, for greater
>>      portability.

What's the harm in leaving the lower case letters in the list?
Sure, in some pathological cases, that'd lead to some wasted time
on case-insensitive systems, but I don't see any portability problem.

Index: shred.c
===================================================================
RCS file: /fetish/cu/src/shred.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -p -u -r1.90 -r1.91
--- a/shred.c   16 May 2004 19:32:30 -0000      1.90
+++ b/shred.c   17 May 2004 12:34:36 -0000      1.91
@@ -1361,7 +1361,7 @@ incname (char *name, size_t len)
 {
   while (len--)
     {
-      char const *p = strchr (nameset, name[--len]);
+      char const *p = strchr (nameset, name[len]);
 
       /* If this character has a successor, use it.  */
       if (p[1])




reply via email to

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