[PATCH 17/18] Place the open() call inside the do{} struct and prevent failing close

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Placing the open() call inside the do{} struct will automatically close the
filehandle if possible.
Placing the close() call outside the do{} struct is useless and will make it
fail systematically
Change the error message to state that what fails is a fork(), not a file
opening.
Use autodie to properly exit when a print or open call fails.

Signed-off-by: Célestin Matte <celestin.matte@xxxxxxxxxx>
Signed-off-by: Matthieu Moy <matthieu.moy@xxxxxxxxxxxxxxx>
---
 contrib/mw-to-git/git-remote-mediawiki.perl |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl
index 952ddcc..20ddccb 100755
--- a/contrib/mw-to-git/git-remote-mediawiki.perl
+++ b/contrib/mw-to-git/git-remote-mediawiki.perl
@@ -23,6 +23,7 @@ binmode STDOUT, ':encoding(UTF-8)';
 
 use URI::Escape;
 use Readonly;
+use autodie;
 
 # Mediawiki filenames can contain forward slashes. This variable decides by which pattern they should be replaced
 Readonly my $SLASH_REPLACEMENT => '%2F';
@@ -363,8 +364,6 @@ sub run_git {
 		local $/ = undef;
 		<$git>
 	};
-	close($git);
-
 	return $res;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]