[Top][All Lists]
[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: |
Sun, 16 May 2004 23:26:46 +0200 |
Paul Eggert <address@hidden> wrote:
> Albert Chin <address@hidden> writes:
>
>> According to the man page ...
>> The fsync subroutine is unsuccessful if one or more of the following
>> are true:
>> ...
>> EINVAL The file is not a regular file.
>
> Thanks for reporting that. I looked through "shred" and found some
> related problems too, while I was at it. Here's a proposed patch,
> relative to CVS coreutils.
>
> 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".
> (datasync) [!HAVE_FDATASYNC]: Remove.
> (dosync): New function.
> (dopass): Use it. Return 1 on write error, -1 on other error.
> All callers changed. Report write error if dosync does.
> (do_wipefd, wipefd, wipename, wipefile): Return bool (true/false),
> not int (0/-1). All callers changed. Return false if there's a
> write error.
> (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.
> (wipename): Use dir_name, base_name, etc. instead of assuming
> Unix file names. Use size_t for length, not unsigned.
> Report error if unlink or close fails.
> (wipename, main): Use bool for booleans.
>
> (names): Use only digits and uppercase letters, for greater
> portability.
Thanks. I've applied that.
- Re: fdatasync() error in shred from coreutils-5.2.1 on AIX 5.2, Paul Eggert, 2004/05/16
- Re: fdatasync() error in shred from coreutils-5.2.1 on AIX 5.2,
Jim Meyering <=
- Re: fdatasync() error in shred from coreutils-5.2.1 on AIX 5.2, Jim Meyering, 2004/05/17
- Re: fdatasync() error in shred from coreutils-5.2.1 on AIX 5.2, Paul Eggert, 2004/05/17
- Re: fdatasync() error in shred from coreutils-5.2.1 on AIX 5.2, Eli Zaretskii, 2004/05/18
- Re: fdatasync() error in shred from coreutils-5.2.1 on AIX 5.2, Paul Eggert, 2004/05/18
- Re: fdatasync() error in shred from coreutils-5.2.1 on AIX 5.2, Eli Zaretskii, 2004/05/19
- Re: fdatasync() error in shred from coreutils-5.2.1 on AIX 5.2, Paul Eggert, 2004/05/19
- Re: fdatasync() error in shred from coreutils-5.2.1 on AIX 5.2, Jim Meyering, 2004/05/18
- Re: fdatasync() error in shred from coreutils-5.2.1 on AIX 5.2, Paul Eggert, 2004/05/18
Re: fdatasync() error in shred from coreutils-5.2.1 on AIX 5.2, Albert Chin, 2004/05/18