From 43a7a8d0852bbb4d0d6684dffbda3b97c8473386 Mon Sep 17 00:00:00 2001 From: Nathan Straz Date: Wed, 28 Apr 2010 11:49:31 -0400 Subject: Close file descriptors left open by parent process Running things in parallel with pthreads in perl can lead to file descriptor leaks which may cause hangs in qarsh. --- qarsh.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qarsh.c b/qarsh.c index 4fa8687..6575bd0 100644 --- a/qarsh.c +++ b/qarsh.c @@ -495,6 +495,10 @@ again: usage(); exit(1); } + /* close fd above stderr which parent may have left open */ + for (c = 3; c < 30; c++) { + close(c); + } memset(&sa, 0, sizeof sa); sigemptyset(&sigmask); -- cgit