Package: portmap Version: 5-9 Severity: normal Tags: patch
The asynchronous SIGCHLD handling function 'reap' in 'portmap.c' uses system call wait3() without preserving global errno. This may lead to unreliable operation under heavier service loads, potentially causing unexpected termination of the service process.
The attached patch adds wrappers to save and restore errno.
This problem has existed for a long time now. It has been reported on freebsd-bugs in June 1998, but a fix doesn't seem to have made it into Debian yet.
[ A similar bug #306925 has been filed for package 'nis'. ]
diff -Nru portmap-5/portmap.c portmap-5.new/portmap.c
--- portmap-5/portmap.c 2005-04-29 13:08:19.593966032 +0200
+++ portmap-5.new/portmap.c 2005-04-29 15:00:17.281779538 +0200
@@ -714,5 +714,7 @@
void
reap()
{
+ int save_errno = errno;
while (wait3((int *)NULL, WNOHANG, (struct rusage *)NULL) > 0);
+ errno = save_errno;
}

