Don't get stuck on detach waiting for SIGSTOP to arrive to stopped process
diff --git a/sysdeps/linux-gnu/trace.c b/sysdeps/linux-gnu/trace.c
index f550dd6..d66ead3 100644
--- a/sysdeps/linux-gnu/trace.c
+++ b/sysdeps/linux-gnu/trace.c
@@ -621,7 +621,8 @@
 {
 	size_t i;
 	for (i = 0; i < pids->count; ++i)
-		if (!pids->tasks[i].got_event
+		if (pids->tasks[i].pid != 0
+		    && !pids->tasks[i].got_event
 		    && !have_events_for(pids->tasks[i].pid))
 			return 0;
 	return 1;
@@ -731,7 +732,7 @@
 		handler->task_enabling_breakpoint
 			= other->task_enabling_breakpoint;
 		if (other->state == psh_sinking) {
-			ugly_workaround(other->task_enabling_breakpoint, 0);
+			ugly_workaround(handler->task_enabling_breakpoint, 1);
 			handler->state = psh_ugly_workaround;
 		} else {
 			handler->state = other->state;
@@ -754,6 +755,11 @@
 			*task_info = *oti;
 		}
 
+		/* The re-enablement handler sets this to NULL when
+		 * it calls continue_for_sigstop_delivery.  */
+		if (other->breakpoint_being_enabled != NULL)
+			continue_for_sigstop_delivery(&handler->pids);
+
 		/* And destroy the original handler.  */
 		destroy_event_handler(proc);
 	}