summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Straz <nstraz@redhat.com>2010-04-28 11:49:31 -0400
committerNathan Straz <nstraz@redhat.com>2010-04-28 11:49:31 -0400
commit43a7a8d0852bbb4d0d6684dffbda3b97c8473386 (patch)
treebd5cb37e1155e254c4d7aa7f8943a36e36581ad9
parent7e577a269e620dd68bc8d903970a69a63a6c2131 (diff)
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.
-rw-r--r--qarsh.c4
1 files changed, 4 insertions, 0 deletions
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);