2003-01-10  Roland McGrath  <roland@redhat.com>

	* strace.c (droptcb): Clear flags word before calling rebuild_pollv.
diff --git a/strace.c b/strace.c
index 1d5f2cc..b91b026 100644
--- a/strace.c
+++ b/strace.c
@@ -991,6 +991,18 @@
 	nprocs--;
 	tcp->pid = 0;
 
+	if (tcp->parent != NULL) {
+		tcp->parent->nchildren--;
+#ifdef TCB_CLONE_THREAD
+		if (tcp->flags & TCB_CLONE_DETACHED)
+			tcp->parent->nclone_detached--;
+		if (tcp->flags & TCB_CLONE_THREAD)
+			tcp->parent->nclone_threads--;
+#endif
+		tcp->parent = NULL;
+	}
+
+	tcp->flags = 0;
 	if (tcp->pfd != -1) {
 		close(tcp->pfd);
 		tcp->pfd = -1;
@@ -1005,25 +1017,14 @@
 		}
 #endif /* !FREEBSD */
 #ifdef USE_PROCFS
-		rebuild_pollv();
+		rebuild_pollv(); /* Note, flags needs to be cleared by now.  */
 #endif
 	}
-	if (tcp->parent != NULL) {
-		tcp->parent->nchildren--;
-#ifdef TCB_CLONE_THREAD
-		if (tcp->flags & TCB_CLONE_DETACHED)
-			tcp->parent->nclone_detached--;
-		if (tcp->flags & TCB_CLONE_THREAD)
-			tcp->parent->nclone_threads--;
-#endif
-		tcp->parent = NULL;
-	}
 
 	if (outfname && followfork > 1 && tcp->outf)
 		fclose(tcp->outf);
 
 	tcp->outf = 0;
-	tcp->flags = 0;
 }
 
 #ifndef USE_PROCFS