Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > bee470e21a8ce2cdd844d7d805aa403d > files > 153

glibc-2.5-49.el5_5.6.src.rpm

2007-01-10  Ulrich Drepper  <drepper@redhat.com>

	* io/fts.c: Make sure fts_cur is always valid after return from
	fts_read.
	Patch by Miloslav Trmac <mitr@redhat.com>.

--- libc/io/fts.c	2 Oct 2006 16:06:49 -0000	1.35
+++ libc/io/fts.c	10 Jan 2007 18:38:19 -0000	1.36
@@ -376,12 +376,14 @@ fts_read(sp)
 		}
 		p = sp->fts_child;
 		sp->fts_child = NULL;
+		sp->fts_cur = p;
 		goto name;
 	}
 
 	/* Move to the next node on this level. */
 next:	tmp = p;
 	if ((p = p->fts_link) != NULL) {
+		sp->fts_cur = p;
 		free(tmp);
 
 		/*
@@ -394,7 +396,7 @@ next:	tmp = p;
 				return (NULL);
 			}
 			fts_load(sp, p);
-			return (sp->fts_cur = p);
+			return p;
 		}
 
 		/*
@@ -420,11 +422,12 @@ next:	tmp = p;
 name:		t = sp->fts_path + NAPPEND(p->fts_parent);
 		*t++ = '/';
 		memmove(t, p->fts_name, p->fts_namelen + 1);
-		return (sp->fts_cur = p);
+		return p;
 	}
 
 	/* Move up to the parent node. */
 	p = tmp->fts_parent;
+	sp->fts_cur = p;
 	free(tmp);
 
 	if (p->fts_level == FTS_ROOTPARENTLEVEL) {
@@ -465,7 +468,7 @@ name:		t = sp->fts_path + NAPPEND(p->fts
 		return (NULL);
 	}
 	p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP;
-	return (sp->fts_cur = p);
+	return p;
 }
 
 /*