From: Eric Wong Date: Fri, 28 Aug 2015 00:21:46 +0000 (+0000) Subject: GitCatFile: remove unnecessary FD_CLOEXEC setting X-Git-Tag: v1.0.0~970 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=608b1e03008b44d7db88bee2b5b6b46cda7583e2;p=public-inbox.git GitCatFile: remove unnecessary FD_CLOEXEC setting Unless some idiot raises $^F, we should not have to care about the close-on-exec flag. Everything since Perl 3.0 seems to set it by default, and 5.6 got more consistent about it. --- diff --git a/lib/PublicInbox/GitCatFile.pm b/lib/PublicInbox/GitCatFile.pm index 9bffce2a..142491e3 100644 --- a/lib/PublicInbox/GitCatFile.pm +++ b/lib/PublicInbox/GitCatFile.pm @@ -6,7 +6,6 @@ package PublicInbox::GitCatFile; use strict; use warnings; -use Fcntl qw(F_GETFD F_SETFD FD_CLOEXEC); use POSIX qw(dup2); sub new { @@ -14,21 +13,13 @@ sub new { bless { git_dir => $git_dir }, $class; } -sub set_cloexec { - my ($fh) = @_; - my $flags = fcntl($fh, F_GETFD, 0) or die "fcntl(F_GETFD): $!\n"; - fcntl($fh, F_SETFD, $flags | FD_CLOEXEC) or die "fcntl(F_SETFD): $!\n"; -} - sub _cat_file_begin { my ($self) = @_; return if $self->{pid}; my ($in_r, $in_w, $out_r, $out_w); pipe($in_r, $in_w) or die "pipe failed: $!\n"; - set_cloexec($_) foreach ($in_r, $in_w); pipe($out_r, $out_w) or die "pipe failed: $!\n"; - set_cloexec($_) foreach ($out_r, $out_w); my @cmd = ('git', "--git-dir=$self->{git_dir}", qw(cat-file --batch)); my $pid = fork;