send-email: use lexical filehandle for opendir
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.comReviewed-by: Avery Pennarun <apenwarr@gmail.com> Reviewed-by: Jeff King <peff@peff.net> > Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Sep 30, 2010 at 13:42 UTC
c6038169a77854c26536f1c95176cbeb237e9e11
1 file changed
+3
-3
git-send-email.perl
+3
-3
@@ -512,12 +512,12 @@ while (defined(my $f = shift @ARGV)) {
512
push @rev_list_opts, "--", @ARGV;
513
@ARGV = ();
514
} elsif (-d $f and !check_file_rev_conflict($f)) {
515
- opendir(DH,$f)
515
+ opendir my $dh, $f
516
or die "Failed to opendir $f: $!";
517
518
push @files, grep { -f $_ } map { catfile($f, $_) }
519
- sort readdir(DH);
520
- closedir(DH);
519
+ sort readdir $dh;
520
+ closedir $dh;
521
} elsif ((-f $f or -p $f) and !check_file_rev_conflict($f)) {
522
push @files, $f;
523
} else {