--- nrpe-1.5-orig/src/nrpe.c	Tue Jun  4 04:08:17 2002
+++ nrpe-1.5/src/nrpe.c	Fri Nov 22 11:37:24 2002
@@ -35,6 +35,7 @@
 void sighandler(int);
 int drop_privileges(char *,char *);
 void free_memory(void);
+void close_files(void);
 int is_an_allowed_host(char *);
 
 int my_system(char *,int,int *,char *,int);            	/* executes a command via popen(), but also protects against timeouts */
@@ -163,6 +164,9 @@
 
 		/* drop privileges */
 		drop_privileges(nrpe_user,nrpe_group);
+		closelog();
+		close_files();
+		openlog("nrpe",LOG_PID,LOG_DAEMON); 
 
 		/* wait for connections */
 		wait_for_connections();
@@ -174,6 +178,12 @@
 	}
 
 
+void close_files() {
+  int i;
+  for(i=0;i<255;i++) {
+    close(i);
+  }
+}
 
 
 /* read in the configuration file */
