소스 검색

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 년 전
부모
커밋
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
 	 */