From: Fabian Keil Date: Mon, 22 Nov 2010 10:34:44 +0000 (+0000) Subject: In write_action_file(), reduce the scope of a fd scalar and convert an open call... X-Git-Tag: v_3_0_18~383 X-Git-Url: http://www.privoxy.org/gitweb/?a=commitdiff_plain;h=f52d0512c7a774a739c2c61ed86b3c766073fc34;p=privoxy.git In write_action_file(), reduce the scope of a fd scalar and convert an open call to use three arguments. --- diff --git a/tools/uagen.pl b/tools/uagen.pl index 55dc63c0..ac647542 100755 --- a/tools/uagen.pl +++ b/tools/uagen.pl @@ -3,7 +3,7 @@ ############################################################################################## # uagen (http://www.fabiankeil.de/sourcecode/uagen/) # -# $Id: uagen.pl,v 1.7 2010/10/30 15:57:26 fabiankeil Exp $ +# $Id: uagen.pl,v 1.8 2010/11/22 10:34:28 fabiankeil Exp $ # # Generates a pseudo-random Firefox user agent and writes it into a Privoxy action file # and optionally into a Mozilla prefs file. For documentation see 'perldoc uagen(.pl)'. @@ -257,10 +257,9 @@ sub write_action_file() { our $action_injection; my $action_file_content = ''; - my $actionfile_fd; if ($action_injection){ - open($actionfile_fd, $action_file) + open(my $actionfile_fd, "<", $action_file) or log_error "Reading action file $action_file failed!"; while (<$actionfile_fd>) { s@(hide-accept-language\{).*?(\})@$1$accept_language$2@; @@ -275,7 +274,7 @@ sub write_action_file() { $action_file_content .= sprintf " +hide-user-agent{%s} \\\n}\n/\n", $user_agent; } - open($actionfile_fd, ">" . $action_file) + open(my $actionfile_fd, ">" . $action_file) or log_error "Writing action file $action_file failed!"; print $actionfile_fd $action_file_content; close($actionfile_fd);