summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortb <tb@openbsd.org>2017-07-17 12:02:53 +0000
committertb <tb@openbsd.org>2017-07-17 12:02:53 +0000
commit04ef9548c2bd3521c096636ce2ebd8047f2dcda7 (patch)
tree44d87ca7b8bfc168bdb93b3af0d729c6ccebbe1e
parentOverhaul handling of vltime and pltime processing (diff)
downloadwireguard-openbsd-04ef9548c2bd3521c096636ce2ebd8047f2dcda7.tar.xz
wireguard-openbsd-04ef9548c2bd3521c096636ce2ebd8047f2dcda7.zip
Optimize and simplify the selection of the latest library version in
reorder_libs(). From Klemens Nanni with input from rpe. ok rpe, zhuk
-rw-r--r--etc/rc13
1 files changed, 5 insertions, 8 deletions
diff --git a/etc/rc b/etc/rc
index 48e5671335f..56a0f2bf3bf 100644
--- a/etc/rc
+++ b/etc/rc
@@ -1,4 +1,4 @@
-# $OpenBSD: rc,v 1.507 2017/07/04 19:02:11 rpe Exp $
+# $OpenBSD: rc,v 1.508 2017/07/17 12:02:53 tb Exp $
# System startup script run by init on autoboot or after single-user.
# Output and error are redirected to console by init, and the console is the
@@ -158,7 +158,7 @@ make_keys() {
# Re-link libraries, placing the objects in a random order.
reorder_libs() {
- local _dkdev _l _liba _libas _mp _tmpdir _remount=false _error=false
+ local _dkdev _liba _libas _mp _tmpdir _remount=false _error=false
[[ $library_aslr == NO ]] && return
@@ -171,13 +171,10 @@ reorder_libs() {
echo -n 'reordering libraries:'
# Only choose the latest version of the libraries.
- for _liba in /usr/lib/libc.so.*.a /usr/lib/libcrypto.so.*.a; do
- _liba=$(ls ${_liba%%.[0-9]*}*.a | sort -V | tail -1)
- for _l in $_libas; do
- [[ $_l == $_liba ]] && continue 2
- done
- _libas="$_libas $_liba"
+ for _liba in /usr/lib/lib{c,crypto}; do
+ _libas="$_libas $(ls $_liba.so.+([0-9.]).a | sort -V | tail -1)"
done
+ _libas=${_libas# }
# Remount read-write, if /usr/lib is on a read-only ffs filesystem.
if [[ $_mp == *' type ffs '*'read-only'* ]]; then