git-cvsserver: indent & clean up authdb code
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Sat, 15 May 2010 02:46:01 +0000 (02:46 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 20 May 2010 04:02:59 +0000 (21:02 -0700)
 - Indent the last commit to fit with the rest of the code.

 - Use lexical filehandles instead of global globs

 - Close the filehandle after the password database has been read.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-cvsserver.perl

index 8b97fb80cf8bd231bd4f278bf60793dda942d596..ed1d5b9d6010797e507ebebce08dd9ed9a0a3b59 100755 (executable)
@@ -194,16 +194,19 @@ if ($state->{method} eq 'pserver') {
             print "I HATE YOU\n";
             exit 1;
         }
-       my $auth_ok;
-       open PASSWD, "<$cfg->{gitcvs}->{authdb}" or die $!;
-       while(<PASSWD>) {
-           if (m{^\Q$user\E:(.*)}) {
-               if (crypt($user, $1) eq $1) {
-                   $auth_ok = 1;
-               }
-           };
-       }
-       unless ($auth_ok) {
+
+        my $auth_ok;
+        open my $passwd, "<", $cfg->{gitcvs}->{authdb} or die $!;
+        while (<$passwd>) {
+            if (m{^\Q$user\E:(.*)}) {
+                if (crypt($user, $1) eq $1) {
+                    $auth_ok = 1;
+                }
+            };
+        }
+        close $passwd;
+
+        unless ($auth_ok) {
             print "I HATE YOU\n";
             exit 1;
         }