From: Don Armstrong Date: Sat, 8 Feb 2014 00:56:33 +0000 (-0800) Subject: close FDs before execing PDF stuff X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=514a3b07d87365c558569874108c4c8467372736;p=bin.git close FDs before execing PDF stuff --- 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;