diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2016-05-03 19:13:05 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2016-05-03 19:13:05 +0000 |
commit | 038c1503d1e9350cd20c8a09443719bfcda1f66d (patch) | |
tree | b37153a44bcc30eaade4a5eab89a7485eca8d6e8 /regress/sys/kern | |
parent | ad5a22515d4bb07e1a70cfd730aa53c327daebcb (diff) |
Fix some Perl statements perlcritic was bitching about: Variable
declared in conditional statement.
Diffstat (limited to 'regress/sys/kern')
-rw-r--r-- | regress/sys/kern/sosplice/Proc.pm | 5 | ||||
-rw-r--r-- | regress/sys/kern/sosplice/Remote.pm | 4 | ||||
-rw-r--r-- | regress/sys/kern/sosplice/error/remote.pl | 4 | ||||
-rw-r--r-- | regress/sys/kern/sosplice/funcs.pl | 19 |
4 files changed, 18 insertions, 14 deletions
diff --git a/regress/sys/kern/sosplice/Proc.pm b/regress/sys/kern/sosplice/Proc.pm index 5ec5315f8c9..39bd30df4ca 100644 --- a/regress/sys/kern/sosplice/Proc.pm +++ b/regress/sys/kern/sosplice/Proc.pm @@ -1,4 +1,4 @@ -# $OpenBSD: Proc.pm,v 1.3 2014/08/18 22:58:19 bluhm Exp $ +# $OpenBSD: Proc.pm,v 1.4 2016/05/03 19:13:04 bluhm Exp $ # Copyright (c) 2010-2014 Alexander Bluhm <bluhm@openbsd.org> # @@ -109,7 +109,8 @@ sub loggrep { my $self = shift; my($regex, $timeout) = @_; - my $end = time() + $timeout if $timeout; + my $end; + $end = time() + $timeout if $timeout; do { my($kid, $status, $code) = $self->wait(WNOHANG); diff --git a/regress/sys/kern/sosplice/Remote.pm b/regress/sys/kern/sosplice/Remote.pm index 293fef26be2..a5c4f9e33ea 100644 --- a/regress/sys/kern/sosplice/Remote.pm +++ b/regress/sys/kern/sosplice/Remote.pm @@ -1,4 +1,4 @@ -# $OpenBSD: Remote.pm,v 1.3 2015/06/25 19:29:57 bluhm Exp $ +# $OpenBSD: Remote.pm,v 1.4 2016/05/03 19:13:04 bluhm Exp $ # Copyright (c) 2010-2014 Alexander Bluhm <bluhm@openbsd.org> # @@ -60,7 +60,7 @@ sub child { my $self = shift; print STDERR $self->{up}, "\n"; - my @opts = split(' ', $ENV{SSH_OPTIONS}) if $ENV{SSH_OPTIONS}; + my @opts = $ENV{SSH_OPTIONS} ? split(' ', $ENV{SSH_OPTIONS}) : (); my $dir = dirname($0); $dir = getcwd() if ! $dir || $dir eq "."; my @cmd = ("ssh", "-n", @opts, $self->{remotessh}, "perl", diff --git a/regress/sys/kern/sosplice/error/remote.pl b/regress/sys/kern/sosplice/error/remote.pl index ae7e50bf1c2..84bd23a300a 100644 --- a/regress/sys/kern/sosplice/error/remote.pl +++ b/regress/sys/kern/sosplice/error/remote.pl @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $OpenBSD: remote.pl,v 1.2 2014/08/18 22:58:19 bluhm Exp $ +# $OpenBSD: remote.pl,v 1.3 2016/05/03 19:13:04 bluhm Exp $ # Copyright (c) 2010-2014 Alexander Bluhm <bluhm@openbsd.org> # @@ -28,7 +28,7 @@ sub usage { my($remotessh, $testfile) = @ARGV; -my @opts = split(' ', $ENV{SSH_OPTIONS}) if $ENV{SSH_OPTIONS}; +my @opts = $ENV{SSH_OPTIONS} ? split(' ', $ENV{SSH_OPTIONS}) : (); my $dir = dirname($0); $dir = getcwd() if ! $dir || $dir eq "."; my @cmd = ("ssh", "-n", @opts, $remotessh, "perl", diff --git a/regress/sys/kern/sosplice/funcs.pl b/regress/sys/kern/sosplice/funcs.pl index aab739f3a62..75856ce6600 100644 --- a/regress/sys/kern/sosplice/funcs.pl +++ b/regress/sys/kern/sosplice/funcs.pl @@ -1,4 +1,4 @@ -# $OpenBSD: funcs.pl,v 1.7 2014/08/18 21:51:45 bluhm Exp $ +# $OpenBSD: funcs.pl,v 1.8 2016/05/03 19:13:04 bluhm Exp $ # Copyright (c) 2010-2013 Alexander Bluhm <bluhm@openbsd.org> # @@ -658,11 +658,12 @@ sub check_relay { sub check_len { my ($c, $r, $s, %args) = @_; - my $clen = $c->loggrep(qr/^LEN: /) // die "no client len" + my ($clen, $rlen, $slen); + $clen = $c->loggrep(qr/^LEN: /) // die "no client len" unless $args{client}{nocheck}; - my $rlen = $r->loggrep(qr/^LEN: /) // die "no relay len" + $rlen = $r->loggrep(qr/^LEN: /) // die "no relay len" if $r && ! $args{relay}{nocheck}; - my $slen = $s->loggrep(qr/^LEN: /) // die "no server len" + $slen = $s->loggrep(qr/^LEN: /) // die "no server len" unless $args{server}{nocheck}; !$clen || !$rlen || $clen eq $rlen or die "client: $clen", "relay: $rlen", "len mismatch"; @@ -681,9 +682,10 @@ sub check_len { sub check_lengths { my ($c, $r, $s, %args) = @_; - my $clengths = $c->loggrep(qr/^LENGTHS: /) + my ($clengths, $slengths); + $clengths = $c->loggrep(qr/^LENGTHS: /) unless $args{client}{nocheck}; - my $slengths = $s->loggrep(qr/^LENGTHS: /) + $slengths = $s->loggrep(qr/^LENGTHS: /) unless $args{server}{nocheck}; !$clengths || !$slengths || $clengths eq $slengths or die "client: $clengths", "server: $slengths", "lengths mismatch"; @@ -698,8 +700,9 @@ sub check_lengths { sub check_md5 { my ($c, $r, $s, %args) = @_; - my $cmd5 = $c->loggrep(qr/^MD5: /) unless $args{client}{nocheck}; - my $smd5 = $s->loggrep(qr/^MD5: /) unless $args{server}{nocheck}; + my ($cmd5, $smd5); + $cmd5 = $c->loggrep(qr/^MD5: /) unless $args{client}{nocheck}; + $smd5 = $s->loggrep(qr/^MD5: /) unless $args{server}{nocheck}; !$cmd5 || !$smd5 || ref($args{md5}) eq 'ARRAY' || $cmd5 eq $smd5 or die "client: $cmd5", "server: $smd5", "md5 mismatch"; my $md5 = ref($args{md5}) eq 'ARRAY' ? |