summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2001-11-24 14:27:42 +0000
committerkrw <krw@openbsd.org>2001-11-24 14:27:42 +0000
commitb8e9c5e8d4327c4d0995f500bf5a92ec56f19782 (patch)
tree44c1ba87433349cc3b318307306b6752a859126b
parentfor openbsd 3.1+, don't even bother trying to pick libdl, since it is dead. (diff)
downloadwireguard-openbsd-b8e9c5e8d4327c4d0995f500bf5a92ec56f19782.tar.xz
wireguard-openbsd-b8e9c5e8d4327c4d0995f500bf5a92ec56f19782.zip
Fix bsort() so that trailing spaces are not emitted.
When a system is rebooted rather than power cycled it is possible for duplicate entries for a disk or cd to appear in the dmesg output. One from the previous boot and one from the current reboot. bsort() correctly filtered out the duplicates, but could emit a trailing space. This trailing space caused problems when, for instance, the root disk was being determined. With the trailing space present, the install or upgrade script would not fill in the default root disk, even if the system only had one disk.
-rw-r--r--distrib/miniroot/install.sub13
1 files changed, 11 insertions, 2 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub
index 5a2fa4df9c9..cd508e44808 100644
--- a/distrib/miniroot/install.sub
+++ b/distrib/miniroot/install.sub
@@ -1,5 +1,5 @@
#!/bin/sh
-# $OpenBSD: install.sub,v 1.176 2001/11/22 00:56:13 krw Exp $
+# $OpenBSD: install.sub,v 1.177 2001/11/24 14:27:42 krw Exp $
# $NetBSD: install.sub,v 1.5.2.8 1996/09/02 23:25:02 pk Exp $
#
# Copyright (c) 1997,1998 Todd Miller, Theo de Raadt
@@ -288,7 +288,16 @@ bsort() {
shift
done
- echo -n "$_a "; bsort $_l
+ echo -n $_a
+
+ # Prevent a trailing blank on the output, and thus a bad value
+ # for cutlast or cutword, by outputting blanks only when $_l
+ # has values to sort.
+
+ if [[ "X$_l" != "X" ]] ; then
+ echo -n " "
+ bsort $_l
+ fi
}
dir_has_sets() {