From: Alexander Achenbach Date: Fri, 20 Apr 2007 02:42:06 +0000 (+1000) Subject: Protect errno inside signal handler. X-Git-Tag: portmap_6.0~23 X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=6c00ba075f7bc90ced9b544b34023cd3c96d35a6;p=portmap.git Protect errno inside signal handler. From: Alexander Achenbach If a signal handler modifies errno at random times, other code can be badly confused. So in 'reap', save and restore it. (From debian) --- diff --git a/portmap.c b/portmap.c index cdf1658..c3c72b9 100644 --- a/portmap.c +++ b/portmap.c @@ -673,5 +673,7 @@ static void callit(struct svc_req *rqstp, SVCXPRT *xprt) static void reap(int ignore) { + int save_errno = errno; while (wait3((int *)NULL, WNOHANG, (struct rusage *)NULL) > 0); + errno = save_errno; }