Просмотр исходного кода

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 18 лет назад
Родитель
Сommit
c5ce3f5a5c
1 измененных файлов с 11 добавлено и 0 удалено
  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
 	 */