Hi
I got this message from du from coreutils 5.2.1:
du: fts_read failed: No such file or directory
*** glibc detected *** corrupted double-linked list: 0x0806c390 ***
I was sometimes able reproduce on an AFS filesystem. It turned out that
AFS filesystem changes inode numbers or device numbers, so
fts_safe_changedir called at the end of fts_read fails. fts_read sets
FTS_STOP, returns NULL and lets fts_cur to point to just freed entry few
lines above (free(tmp)). The next call to fts_close will do a double-free.
This patch fixes the problem in this situation (and other possible
scenarios resulting from various syscalls failing) --- however you should
better go through the whole code for handling of fts tree and check it.
Mikulas
--- lib/fts.c_ 2005-10-10 18:04:57.000000000 +0200
+++ lib/fts.c 2005-10-10 18:05:49.000000000 +0200
@@ -610,6 +610,7 @@
if (p->fts_level == FTS_ROOTLEVEL) {
if (FCHDIR(sp, sp->fts_rfd)) {
SET(FTS_STOP);
+ sp->fts_cur = p;
return (NULL);
}
fts_load(sp, p);
@@ -671,6 +672,7 @@
if (p->fts_level == FTS_ROOTLEVEL) {
if (FCHDIR(sp, sp->fts_rfd)) {
SET(FTS_STOP);
+ sp->fts_cur = p;
return (NULL);
}
} else if (p->fts_flags & FTS_SYMFOLLOW) {
@@ -679,12 +681,14 @@
(void)close(p->fts_symfd);
__set_errno (saved_errno);
SET(FTS_STOP);
+ sp->fts_cur = p;
return (NULL);
}
(void)close(p->fts_symfd);
} else if (!(p->fts_flags & FTS_DONTCHDIR) &&
fts_safe_changedir(sp, p->fts_parent, -1, "..")) {
SET(FTS_STOP);
+ sp->fts_cur = p;
return (NULL);
}
p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP;
_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils