- you don't need to call unlock_db. When the process dies, the fd dies with
it, and the lock.

- I've committed glue to PackageInfo.pm to make lock_db self-contained
(it will pull BaseState in on an "as needed" basis, which also comes in
handy for other locks prior to having a state)

Index: fw_update.sh
===================================================================
RCS file: /cvs/src/usr.sbin/fw_update/fw_update.sh,v
retrieving revision 1.37
diff -u -p -r1.37 fw_update.sh
--- fw_update.sh        11 Feb 2022 00:46:58 -0000      1.37
+++ fw_update.sh        14 Feb 2022 10:35:57 -0000
@@ -206,13 +206,11 @@ lock_db() {
        perl <<'EOL' |&
                use v5.16;
                use warnings;
-               use OpenBSD::PackageInfo qw< lock_db unlock_db >;
-               use OpenBSD::BaseState;
+               use OpenBSD::PackageInfo qw< lock_db >;
 
                $|=1;
 
-               lock_db(0, 'OpenBSD::BaseState');
-               END { unlock_db }
+               lock_db(0);
                $SIG{TERM} = sub { exit };
        
                say $$;

Reply via email to