From 55e37a3e157cef79210ba1852d7e947d9ccd40c2 Mon Sep 17 00:00:00 2001 From: Cary Sandvig Date: Thu, 19 Oct 2000 22:52:59 +0000 Subject: [PATCH] fixed login bug for multiple lines in .cvspass --- dtool/src/attach/ctcvs.pl | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/dtool/src/attach/ctcvs.pl b/dtool/src/attach/ctcvs.pl index 9a0bd033f9..c00d5fdffc 100644 --- a/dtool/src/attach/ctcvs.pl +++ b/dtool/src/attach/ctcvs.pl @@ -56,19 +56,26 @@ sub CTCvsLogin { } &CTUDebug( "looking for '" . $path . "'\n" ) ; if ( -e $path ) { + local( $passdone ) = 0 ; + local( $ok ) = 0 ; open( PASSFILE, "< $path" ) ; - $_ = ; - s/\n$// ; - local( @line ) = split ; - # ok, the server line is in [0] and the password in [1]. - &CTUDebug( "server line from .cvspass is '" . $line[0] . "'\n" ) ; - if ( $line[0] ne $_[0] ) { + while ( ) { + s/\n$// ; + local( @line ) = split ; + # ok, the server line is in [0] and the password in [1]. + &CTUDebug( "server line from .cvspass is '" . $line[0] . + "'\n" ) ; + if ( $line[0] eq $_[0] ) { + # we're fine, we're already logged in to that + $ret = 1 ; + $passdone = 1; + } + } + if ( ! $passdone ) { + # ran out of lines in the file local( $line ) = "cvs -d " . $_[0] . " login >/dev/null" ; &CTUDebug( "about to run '" . $line . "'\n" ) ; $ret = &CTURetCode( system( $line )) ; - } else { - # we're fine, we're already logged in to that - $ret = 1 ; } } else { &CTUDebug( $path . " file does not exist\n" ) ;