From 6e4162b6871ca562999545d637e2dc462baf4231 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Fri, 1 Sep 2000 20:08:45 +0200
Subject: [PATCH] More paranoid use of pid->wait().

Rev: NT/tools/sprshd:1.21
---
 NT/tools/sprshd | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/NT/tools/sprshd b/NT/tools/sprshd
index c7d9e5c26f..e9c83ba5f0 100755
--- a/NT/tools/sprshd
+++ b/NT/tools/sprshd
@@ -1,4 +1,5 @@
 #!/usr/local/bin/pike
+/* -*- Pike -*- */
 
 inherit Stdio.Port;
 
@@ -273,7 +274,13 @@ void handle_incoming_connection(object(Stdio.File) io)
 	}
 	
 	io->write(sprintf("%4c",0));
-	io->write(sprintf("%4c",p->wait()));
+	int code;
+	if (catch { code = p->wait(); }) {
+	  // wait() failed.
+	  io->write(sprintf("%4c", -1));
+	} else {
+	  io->write(sprintf("%4c", code));
+	}
       }else{
 	werror("dir=%s\n",dir);
 	werror(master()->describe_backtrace(err));
-- 
GitLab