changeset 6540:904f6a889206

Sync from coreutils. Avoid the double-free (first in fts_read, second in fts_close) that would occur when an `active' directory is made inaccessible (e.g., via chmod a-x) during a traversal. * lib/fts.c (fts_read): After a failed fchdir, update sp->fts_cur before returning. Reproduce this failure by mkdir -p a/b; cd a; chmod a-x . b * lib/sha1.c: Tweak grammar in a comment. * m4/fpending.m4: Also include <stdio.h>, for Dragonfly. * m4/memcoll.m4 (gl_MEMCOLL): Don't require AC_FUNC_MEMCMP, undoing the 2002-12-31 change.
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 10 Jan 2006 21:31:01 +0000
parents 5a1c91276525
children 7ff05154452e
files lib/ChangeLog lib/fts.c lib/sha1.c m4/ChangeLog m4/fpending.m4 m4/memcoll.m4
diffstat 6 files changed, 32 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,16 @@
+2006-01-10  Jim Meyering  <jim@meyering.net>
+
+	Avoid the double-free (first in fts_read, second in fts_close) that
+	would occur when an `active' directory is made inaccessible (e.g.,
+	via chmod a-x) during a traversal.
+	* fts.c (fts_read): After a failed fchdir, update sp->fts_cur
+	before returning.  Reproduce this failure by
+	mkdir -p a/b; cd a; chmod a-x . b
+	Reported by Stavros Passas.
+
+	Sync from coreutils.
+	* sha1.c: Tweak grammar in a comment.
+
 2006-01-10  Paul Eggert  <eggert@cs.ucla.edu>
 
 	* regex_internal.h (BITSET_WORD_BITS):
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -522,6 +522,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);
--- a/lib/sha1.c
+++ b/lib/sha1.c
@@ -77,7 +77,7 @@
    must be in little endian byte order.
 
    IMPORTANT: On some systems it is required that RESBUF is correctly
-   aligned for a 32 bits value.  */
+   aligned for a 32-bit value.  */
 void *
 sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf)
 {
@@ -94,7 +94,7 @@
    prolog according to the standard and write the result to RESBUF.
 
    IMPORTANT: On some systems it is required that RESBUF is correctly
-   aligned for a 32 bits value.  */
+   aligned for a 32-bit value.  */
 void *
 sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf)
 {
--- a/m4/ChangeLog
+++ b/m4/ChangeLog
@@ -1,3 +1,15 @@
+2006-01-10  Jim Meyering  <jim@meyering.net>
+
+	* fpending.m4: Also include <stdio.h>, for Dragonfly.
+	Patch by Joerg Sonnenberger.
+
+2006-01-10  Paul Eggert  <eggert@cs.ucla.edu>
+
+	* memcoll.m4 (gl_MEMCOLL): Don't require AC_FUNC_MEMCMP, undoing
+	the 2002-12-31 change.  Problem and fix reported by Bruno Haible.
+	People who are still concerned with buggy memcmp implementations
+	can invoke gl_FUNC_MEMCMP themselves.
+
 2006-01-10  Simon Josefsson  <jas@extundo.com>
 
 	* sys_socket_h.m4: New file.
--- a/m4/fpending.m4
+++ b/m4/fpending.m4
@@ -1,6 +1,6 @@
-#serial 7
+#serial 8
 
-# Copyright (C) 2000, 2001, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2001, 2004, 2005, 2006 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -20,6 +20,7 @@
   AC_CHECK_HEADERS(stdio_ext.h)
   AC_REPLACE_FUNCS([__fpending])
   fp_headers='
+#     include <stdio.h>
 #     if HAVE_STDIO_EXT_H
 #      include <stdio_ext.h>
 #     endif
--- a/m4/memcoll.m4
+++ b/m4/memcoll.m4
@@ -1,4 +1,4 @@
-# memcoll.m4 serial 5
+# memcoll.m4 serial 6
 dnl Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -10,6 +10,5 @@
   AC_LIBOBJ([memcoll])
 
   dnl Prerequisites of lib/memcoll.c.
-  AC_REQUIRE([AC_FUNC_MEMCMP])
   AC_FUNC_STRCOLL
 ])