Module Name:    src
Committed By:   martin
Date:           Thu Jan 12 12:05:20 UTC 2023

Modified Files:
        src/usr.bin/ldd [netbsd-10]: ldd.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #41):

        usr.bin/ldd/ldd.c: revision 1.28

avoid printing the latest error message if some ldd method worked.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.27.2.1 src/usr.bin/ldd/ldd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/ldd/ldd.c
diff -u src/usr.bin/ldd/ldd.c:1.27 src/usr.bin/ldd/ldd.c:1.27.2.1
--- src/usr.bin/ldd/ldd.c:1.27	Tue Oct 18 19:04:57 2022
+++ src/usr.bin/ldd/ldd.c	Thu Jan 12 12:05:20 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ldd.c,v 1.27 2022/10/18 19:04:57 mrg Exp $	*/
+/*	$NetBSD: ldd.c,v 1.27.2.1 2023/01/12 12:05:20 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: ldd.c,v 1.27 2022/10/18 19:04:57 mrg Exp $");
+__RCSID("$NetBSD: ldd.c,v 1.27.2.1 2023/01/12 12:05:20 martin Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -124,7 +124,7 @@ main(int argc, char **argv)
 	const char *fmt1 = NULL, *fmt2 = NULL;
 	int c, exit_status = EXIT_SUCCESS;
 	char cwd[MAXPATHLEN], path[MAXPATHLEN];
-	bool verbose = false, failed = false;
+	bool verbose = false;
 
 #ifdef DEBUG
 	debug = 1;
@@ -164,6 +164,7 @@ main(int argc, char **argv)
 
 	for (; argc != 0; argc--, argv++) {
 		int fd;
+		bool failed = false;
 
 		if (**argv != '/') {
 			strcpy(path, cwd);
@@ -185,17 +186,20 @@ main(int argc, char **argv)
 		}
 		/* Alpha never had 32 bit support. */
 #if (defined(_LP64) && !defined(ELF64_ONLY)) || defined(MIPS_N32)
-		if (failed && elf32_ldd(fd, *argv, path, fmt1, fmt2) == -1) {
-			if (verbose)
-				warnx("%s", error_message);
-			failed = true;
+		if (failed) {
+			if (elf32_ldd(fd, *argv, path, fmt1, fmt2) == -1) {
+				if (verbose)
+					warnx("%s", error_message);
+			} else
+				failed = false;
 		}
 #if defined(__mips__) && 0 /* XXX this is still hosed for some reason */
-		if (failed &&
-		    elf32_ldd_compat(fd, *argv, path, fmt1, fmt2) == -1) {
-			if (verbose)
-				warnx("%s", error_message);
-			failed = true;
+		if (failed) {
+			if (elf32_ldd_compat(fd, *argv, path, fmt1, fmt2) == -1) {
+				if (verbose)
+					warnx("%s", error_message);
+			} else
+				failed = false;
 		}
 #endif
 #endif

Reply via email to