* nih/child.c (nih_child_poll): Zero the siginfo_t struct before
every call to waitid(), the kernel doesn't do it for us when
running the compat syscall (but does for the native one *sigh).
diff --git a/ChangeLog b/ChangeLog
index f945d99..e9107a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-09-13  Scott James Remnant  <scott@netsplit.com>
+
+	* nih/child.c (nih_child_poll): Zero the siginfo_t struct before
+	every call to waitid(), the kernel doesn't do it for us when
+	running the compat syscall (but does for the native one *sigh).
+
 2006-09-08  Scott James Remnant  <scott@netsplit.com>
 
 	* TODO: Update.
diff --git a/nih/child.c b/nih/child.c
index a27b3d4..85504b8 100644
--- a/nih/child.c
+++ b/nih/child.c
@@ -27,6 +27,8 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 
+#include <string.h>
+
 #include <nih/macros.h>
 #include <nih/alloc.h>
 #include <nih/list.h>
@@ -121,7 +123,15 @@
 
 	nih_child_init ();
 
-	info.si_pid = 0;
+	/* NOTE: there's a strange kernel inconsistency, when the waitid()
+	 * syscall is native, it takes special care to zero this struct
+	 * before returning ... but when it's a compat syscall, it
+	 * specifically *doesn't* zero the struct.
+	 *
+	 * So we have to take care to do it ourselves before every call.
+	 */
+	memset (&info, 0, sizeof (info));
+
 	while (waitid (P_ALL, 0, &info, WEXITED | WNOHANG | WNOWAIT) == 0) {
 		pid_t pid;
 		int   killed, status;
@@ -146,6 +156,10 @@
 		}
 
 		/* Reap the child */
+		memset (&info, 0, sizeof (info));
 		waitid (P_PID, pid, &info, WEXITED);
+
+		/* For next waitid call */
+		memset (&info, 0, sizeof (info));
 	}
 }