pointed out by kn, tested in snaps for a week
#!/bin/ksh
-# $OpenBSD: install.sub,v 1.1198 2022/05/09 22:43:57 deraadt Exp $
+# $OpenBSD: install.sub,v 1.1199 2022/05/16 00:27:46 deraadt Exp $
#
# Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback
# Copyright (c) 2015, Robert Peichaer <rpe@openbsd.org>
# Add a trap to kill the dmesg listener co-process on exit of the installer.
retrap() {
- trap 'if [ -f /tmp/cppid ]; then kill -KILL -$(cat /tmp/cppid) 2>/dev/null; rm -f /tmp/cppid; fi; echo; stty echo; exit 0' \
+ trap '_cppid=$(</tmp/cppid); if [ -n $_cppid ]; then kill -KILL -$_cppid 2>/dev/null; rm -f /tmp/cppid; fi; echo; stty echo; exit 0' \
INT EXIT TERM
}