diff --git a/src/signal_handler.c b/src/signal_handler.c
index 4a15bf4f5d2cb4bfe96c06427a223f97645ad03d..68b3a36552657a16233b0d272b7895843f4b534f 100644
--- a/src/signal_handler.c
+++ b/src/signal_handler.c
@@ -23,7 +23,7 @@
 #include "builtin_functions.h"
 #include <signal.h>
 
-RCSID("$Id: signal_handler.c,v 1.97 1999/01/08 00:51:53 hubbe Exp $");
+RCSID("$Id: signal_handler.c,v 1.98 1999/01/08 01:27:28 hubbe Exp $");
 
 #ifdef HAVE_PASSWD_H
 # include <passwd.h>
@@ -575,7 +575,20 @@ static void f_pid_status_wait(INT32 args)
       pid=THIS->pid;
 
       if(err)
-	error("Pike lost track of a child, pid=%d, errno=%d.\n",pid,err);
+      {
+
+#define BUGGY_WAITPID
+
+#ifdef BUGGY_WAITPID
+	struct svalue key,*s;
+	key.type=T_INT;
+	key.u.integer=pid;
+	s=low_mapping_lookup(pid_mapping, &key);
+	if(!s || s->type != T_OBJECT || s->u.object != fp->current_object)
+#endif
+	  error("Pike lost track of a child, pid=%d, errno=%d.\n",pid,err);
+
+      }
 
       THREADS_ALLOW();
 #ifdef HAVE_WAITPID
@@ -585,6 +598,7 @@ static void f_pid_status_wait(INT32 args)
       pid=wait4(pid,&status,0,0);
 #else
       pid=-1;
+      errno=ENOTSUP;
 #endif
 #endif
       THREADS_DISALLOW();