Explorar o código

Patch to close all open files on background run operation.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1474 fd59a12c-fef9-0310-b244-a6a79926bd2f
Steven Dake %!s(int64=18) %!d(string=hai) anos
pai
achega
c5ce3f5a5c
Modificáronse 1 ficheiros con 11 adicións e 0 borrados
  1. 11 0
      exec/main.c

+ 11 - 0
exec/main.c

@@ -280,6 +280,17 @@ static void aisexec_mempool_init (void)
 
 static void aisexec_tty_detach (void)
 {
+	int lpc;
+	struct rlimit oflimits;
+
+	/*
+	 * close all open files
+	 */
+	getrlimit(RLIMIT_NOFILE, &oflimits);
+	for (lpc = 0; lpc < oflimits.rlim_cur; lpc++) {
+		close(lpc);
+	}
+
 	/*
 	 * Disconnect from TTY if this is not a debug run
 	 */