Discard stdout/err only where needed in check_unattendedupgrade()
authorkn <kn@openbsd.org>
Mon, 10 Oct 2022 11:04:17 +0000 (11:04 +0000)
committerkn <kn@openbsd.org>
Mon, 10 Oct 2022 11:04:17 +0000 (11:04 +0000)
We should be fine silencing only the test condition which produces legit
output and warnings.

All else produces no output and should not error out;  if it does, those
warnings should be printed and fixed.

Feedback OK halex

distrib/miniroot/install.sub

index e7ae9f4..26d00cd 100644 (file)
@@ -1,5 +1,5 @@
 #!/bin/ksh
-#      $OpenBSD: install.sub,v 1.1210 2022/10/05 19:30:47 kn Exp $
+#      $OpenBSD: install.sub,v 1.1211 2022/10/10 11:04:17 kn Exp $
 #
 # Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback
 # Copyright (c) 2015, Robert Peichaer <rpe@openbsd.org>
@@ -3317,7 +3317,7 @@ check_unattendedupgrade() {
        _d=${_d%% *}
        if [[ -n $_d ]]; then
                make_dev $_d
-               if mount -t ffs -r /dev/${_d}a /mnt; then
+               if mount -t ffs -r /dev/${_d}a /mnt 2>/dev/null; then
                        [[ -f /mnt/bsd.upgrade && -f /mnt/auto_upgrade.conf ]]
                        _rc=$?
                        ((_rc == 0)) && cp /mnt/auto_upgrade.conf /
@@ -3325,7 +3325,7 @@ check_unattendedupgrade() {
                        umount /mnt
                fi
                rm -f /dev/{r,}$_d?
-       fi >/dev/null 2>&1
+       fi
 
        return $_rc
 }