git: 481273492bbb - stable/13 - rc.d/ldconfig: Prepend rtld stdlib paths to ldconfig(32)_paths

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Tue, 28 Nov 2023 11:43:05 UTC
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=481273492bbbab5ee1978a24e55b13c1f39bc560

commit 481273492bbbab5ee1978a24e55b13c1f39bc560
Author:     John W. O'Brien <john@saltant.com>
AuthorDate: 2023-11-12 22:45:27 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-11-28 11:42:22 +0000

    rc.d/ldconfig: Prepend rtld stdlib paths to ldconfig(32)_paths
    
    PR:                     275031
    
    (cherry picked from commit 99132daf6f70cb0cc969c555d3612547fa3cf1db)
---
 libexec/rc/rc.d/ldconfig | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libexec/rc/rc.d/ldconfig b/libexec/rc/rc.d/ldconfig
index 92e3441b008f..ae25d59ad4ae 100755
--- a/libexec/rc/rc.d/ldconfig
+++ b/libexec/rc/rc.d/ldconfig
@@ -22,7 +22,7 @@ ldconfig_start()
 	ldconfig=${ldconfig_command}
 	checkyesno ldconfig_insecure && _ins="-i"
 	if [ -x "${ldconfig_command}" ]; then
-		_LDC="/lib /usr/lib"
+		_LDC=$(/libexec/ld-elf.so.1 -v | sed -n -e '/^Default lib path /s///p' | tr : ' ')
 		for i in ${ldconfig_local_dirs}; do
 			if [ -d "${i}" ]; then
 				_files=`find ${i} -type f`
@@ -52,6 +52,9 @@ ldconfig_start()
 				fi
 			done
 			_LDC=""
+			if [ -x /libexec/ld-elf32.so.1 ]; then
+				_LDC=$(/libexec/ld-elf32.so.1 -v | sed -n -e '/^Default lib path /s///p' | tr : ' ')
+			fi
 			for i in ${ldconfig32_paths}; do
 				if [ -r "${i}" ]; then
 					_LDC="${_LDC} ${i}"