From 514a3b07d87365c558569874108c4c8467372736 Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Fri, 7 Feb 2014 16:56:33 -0800 Subject: [PATCH] close FDs before execing PDF stuff --- bibtex_to_paper | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bibtex_to_paper b/bibtex_to_paper index 121a855..23e0085 100755 --- a/bibtex_to_paper +++ b/bibtex_to_paper @@ -18,6 +18,7 @@ use File::Spec qw(rel2abs); use Text::BibTeX; use User; use Data::Printer; +use POSIX; use DBI; @@ -223,6 +224,11 @@ sub fork_exec { die "Unable to fork for some reason: $!"; } if ($child == 0) { + foreach (0 .. (POSIX::sysconf (&POSIX::_SC_OPEN_MAX) || 1024)) + { POSIX::close $_ } + open (STDIN, "/dev/null"); + open (STDERR, ">&STDOUT"); exec(@cmd); } else { return $child; -- 2.39.2