[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: coreutils CVS test failure on IRIX 6.5
From: |
Paul Eggert |
Subject: |
Re: coreutils CVS test failure on IRIX 6.5 |
Date: |
Sat, 29 May 2004 01:25:27 -0700 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
address@hidden (Albert Chin-A-Young) writes:
> + shred --remove --exact a b
> shred: .: fdatasync failed: Bad file number
Thanks for reporting that problem. Does the following patch fix it?
2004-05-29 Paul Eggert <address@hidden>
* src/shred.c (dosync): Ignore EBADF errors, as IRIX 6.5
fdatasync reports EBADF when syncing (unwritable) directories.
Problem reported by Albert Chin-A-Young in:
http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00165.html
Index: src/shred.c
===================================================================
RCS file: /home/meyering/coreutils/cu/src/shred.c,v
retrieving revision 1.93
diff -p -u -r1.93 shred.c
--- src/shred.c 20 May 2004 11:35:40 -0000 1.93
+++ src/shred.c 29 May 2004 08:19:56 -0000
@@ -774,10 +774,11 @@ passname (unsigned char const *data, cha
}
/* Request that all data for FD be transferred to the corresponding
- storage device. QNAME is the file name (quoted for colons), and
- *ST its status. Report any errors found. Return 0 on success, -1
+ storage device. QNAME is the file name (quoted for colons).
+ Report any errors found. Return 0 on success, -1
(setting errno) on failure. It is not an error if fdatasync and/or
- fsync is not supported for this file. */
+ fsync is not supported for this file, or if the file is not a
+ writable file descriptor. */
static int
dosync (int fd, char const *qname)
{
@@ -787,7 +788,7 @@ dosync (int fd, char const *qname)
if (fdatasync (fd) == 0)
return 0;
err = errno;
- if (err != EINVAL)
+ if (err != EINVAL && err != EBADF)
{
error (0, err, _("%s: fdatasync failed"), qname);
errno = err;
@@ -798,7 +799,7 @@ dosync (int fd, char const *qname)
if (fsync (fd) == 0)
return 0;
err = errno;
- if (err != EINVAL)
+ if (err != EINVAL && err != EBADF)
{
error (0, err, _("%s: fsync failed"), qname);
errno = err;
@@ -1399,8 +1400,8 @@ incname (char *name, size_t len)
* is ANSI-standard.
*
* To force the directory data out, we try to open the directory and
- * invoke fdatasync on it. This is rather non-standard, so we don't
- * insist that it works, just fall back to a global sync in that case.
+ * invoke fdatasync and/or fsync on it. This is non-standard, so don't
+ * insist that it works: just fall back to a global sync in that case.
* This is fairly significantly Unix-specific. Of course, on any
* filesystem with synchronous metadata updates, this is unnecessary.
*/