Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Dec 2021 01:08:26 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 0619dbdfde6d - stable/13 - ldconfig(8): check for no-args command line after options are parsed
Message-ID:  <202112010108.1B118QBd035770@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=0619dbdfde6d05ac99265ff0b0944468788678dd

commit 0619dbdfde6d05ac99265ff0b0944468788678dd
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-11-19 04:07:58 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2021-12-01 01:07:19 +0000

    ldconfig(8): check for no-args command line after options are parsed
    
    (cherry picked from commit 3ede04c78c7c726ed79a39d22c65a58d0ecc5d00)
---
 sbin/ldconfig/ldconfig.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/sbin/ldconfig/ldconfig.c b/sbin/ldconfig/ldconfig.c
index 288c22813121..b039412a648b 100644
--- a/sbin/ldconfig/ldconfig.c
+++ b/sbin/ldconfig/ldconfig.c
@@ -90,9 +90,7 @@ main(int argc, char **argv)
 		hints_file = _PATH_ELF32_HINTS;
 	else
 		hints_file = _PATH_ELF_HINTS;
-	if (argc == 1)
-		rescan = true;
-	else while((c = getopt(argc, argv, "Rf:imrsv")) != -1) {
+	while((c = getopt(argc, argv, "Rf:imrsv")) != -1) {
 		switch (c) {
 		case 'R':
 			rescan = true;
@@ -121,11 +119,14 @@ main(int argc, char **argv)
 		}
 	}
 
-	if (justread)
+	if (justread) {
 		list_elf_hints(hints_file);
-	else
+	} else {
+		if (argc == optind)
+			rescan = true;
 		update_elf_hints(hints_file, argc - optind,
 		    argv + optind, merge || rescan);
+	}
 	exit(0);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202112010108.1B118QBd035770>