summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorespie <espie@openbsd.org>2015-02-03 21:37:54 +0000
committerespie <espie@openbsd.org>2015-02-03 21:37:54 +0000
commit16a35e58c4b68284d2e4090d846421518a414e13 (patch)
treeb2300709960a38f41d70974392121e66e2b8651c
parentMake the mandoc test suite completely silent. (diff)
downloadwireguard-openbsd-16a35e58c4b68284d2e4090d846421518a414e13.tar.xz
wireguard-openbsd-16a35e58c4b68284d2e4090d846421518a414e13.zip
fix odd error recovery (noticed by kili@): fw_update -d with !installed
driver should just say it's not installed and not try to install it.
-rw-r--r--usr.sbin/pkg_add/OpenBSD/FwUpdate.pm12
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/FwUpdate.pm b/usr.sbin/pkg_add/OpenBSD/FwUpdate.pm
index 672285a99f6..c61323c23d1 100644
--- a/usr.sbin/pkg_add/OpenBSD/FwUpdate.pm
+++ b/usr.sbin/pkg_add/OpenBSD/FwUpdate.pm
@@ -1,7 +1,7 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: FwUpdate.pm,v 1.14 2015/02/03 10:26:29 espie Exp $
+# $OpenBSD: FwUpdate.pm,v 1.15 2015/02/03 21:37:54 espie Exp $
#
# Copyright (c) 2014 Marc Espie <espie@openbsd.org>
#
@@ -291,12 +291,14 @@ sub process_parameters
$state->errsay("#1: unknown driver", $driver);
exit(1);
}
+ if ($state->opt('d') &&
+ !$state->is_installed($driver)) {
+ $state->errsay("Can't delete uninstalled driver: #1", $driver);
+ next;
+ }
+
my $set = $self->to_add_or_update($state, $driver);
if ($state->opt('d')) {
- if (!$state->is_installed($driver)) {
- $state->errsay("Can't delete uninstalled driver: #1", $driver);
- next;
- }
$self->mark_set_for_deletion($set);
}
}