From 607029a69862ebe09058335e21da62363e65f88c Mon Sep 17 00:00:00 2001 From: kn Date: Wed, 19 Oct 2022 08:24:14 +0000 Subject: [PATCH] Get rid of useless/confusing subshell Other function, same stuff like r1.1210 except here there `>/dev/null 2>&1' hammer is required to silence the ls(1) test. The make_dev() call is no longer silenced now but does not print on stdout anyway; if making the device fails we'd like to know. Otherwise if probing the disk fails it continues to be silenced. (cvs diff -w -U1) |@@ -2311,3 +2311,2 @@ is_rootdisk() { | |- ( | make_dev $_d |@@ -2322,6 +2321,6 @@ is_rootdisk() { | umount /mnt |- fi |+ fi >/dev/null 2>&1 | rm -f /dev/{r,}$_d? |+ | return $_rc |- ) >/dev/null 2>&1 | } OK halex --- distrib/miniroot/install.sub | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 2665e66eae3..356f15ba46d 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,5 +1,5 @@ #!/bin/ksh -# $OpenBSD: install.sub,v 1.1212 2022/10/16 08:47:20 kn Exp $ +# $OpenBSD: install.sub,v 1.1213 2022/10/19 08:24:14 kn Exp $ # # Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback # Copyright (c) 2015, Robert Peichaer @@ -2309,21 +2309,20 @@ set_timezone() { is_rootdisk() { local _d=$1 _rc=1 - ( - make_dev $_d - if disklabel $_d | grep -q '^ a: .*4\.2BSD ' && - mount -t ffs -r /dev/${_d}a /mnt; then - if $UU; then - ls -d /mnt/{auto_upgrade.conf,bin,dev,etc,home,sbin,tmp,usr,var} - else - ls -d /mnt/{bin,dev,etc,home,sbin,tmp,usr,var} - fi - _rc=$? - umount /mnt + make_dev $_d + if disklabel $_d | grep -q '^ a: .*4\.2BSD ' && + mount -t ffs -r /dev/${_d}a /mnt; then + if $UU; then + ls -d /mnt/{auto_upgrade.conf,bin,dev,etc,home,sbin,tmp,usr,var} + else + ls -d /mnt/{bin,dev,etc,home,sbin,tmp,usr,var} fi - rm -f /dev/{r,}$_d? - return $_rc - ) >/dev/null 2>&1 + _rc=$? + umount /mnt + fi >/dev/null 2>&1 + rm -f /dev/{r,}$_d? + + return $_rc } # Get global root information. ie. ROOTDISK, ROOTDEV and SWAPDEV. -- 2.20.1