From 0596671305048aa54ee7fbeb2077be4a05377d98 Mon Sep 17 00:00:00 2001 From: espie Date: Mon, 9 May 2022 08:29:04 +0000 Subject: [PATCH] shadowing variables is a bad idea (thanks Anton, this fixes regress) also fix a logic error (that's very unlikely to happen outside of broken scenarios, but we still want to have things work correctly in that context) --- usr.sbin/pkg_add/OpenBSD/PkgAdd.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm b/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm index 9ca9eaff5f8..10ce2232f1f 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm @@ -1,7 +1,7 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: PkgAdd.pm,v 1.131 2022/05/08 11:06:06 espie Exp $ +# $OpenBSD: PkgAdd.pm,v 1.132 2022/05/09 08:29:04 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie # @@ -98,13 +98,14 @@ sub tie_files my ($tied, $realname); for my $c (@{$sha->{$self->{d}->key}}) { # don't tie if there's a problem with the file - my $realname = $c->realname($state); + $realname = $c->realname($state); next unless -f $realname; # and do a sanity check that this file wasn't altered next unless (stat _)[7] == $self->{size}; $tied = $c; last if $tied->name eq $self->name; } + return if !defined $tied; if ($state->defines('checksum')) { my $d = $self->compute_digest($realname, $self->{d}); # XXX we don't have to display anything here -- 2.20.1