diff -ruN postgresql-7.4.13-old/src/pgcluster/pgrp/main.c postgresql-7.4.13/src/pgcluster/pgrp/main.c
--- postgresql-7.4.13-old/src/pgcluster/pgrp/main.c	2006-08-14 18:28:02.000000000 +0200
+++ postgresql-7.4.13/src/pgcluster/pgrp/main.c	2006-08-14 18:34:05.000000000 +0200
@@ -34,6 +34,7 @@
 #include <sys/param.h>
 #include <arpa/inet.h>
 #include <sys/file.h>
+#include <sys/resource.h>
 
 #ifdef HAVE_NETINET_TCP_H
 #include <netinet/tcp.h>
@@ -673,6 +674,15 @@
 	pid_t rlog_pid = 0;
 	int sig_opt = SIGTERM;
 
+	struct rlimit   oflimits;
+	int             curlim;
+
+	getrlimit(RLIMIT_NOFILE, &oflimits);
+	/* close all (possibly) open file descriptors except std{in,out,err} */
+	for (curlim=3; curlim < oflimits.rlim_cur; ++curlim) {
+		close(curlim);
+	}
+
 	/* init global variables */
 	PGR_Init_Com_Info(&Com_Info);
 
