Module Name:    src
Committed By:   mrg
Date:           Tue Oct 18 19:04:57 UTC 2022

Modified Files:
        src/usr.bin/ldd: ldd.c

Log Message:
only try the other methods if the previous ones failed.

fixes problem reported by ryoon@


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 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.26 src/usr.bin/ldd/ldd.c:1.27
--- src/usr.bin/ldd/ldd.c:1.26	Sat Oct 15 05:55:45 2022
+++ src/usr.bin/ldd/ldd.c	Tue Oct 18 19:04:57 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ldd.c,v 1.26 2022/10/15 05:55:45 mrg Exp $	*/
+/*	$NetBSD: ldd.c,v 1.27 2022/10/18 19:04:57 mrg 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.26 2022/10/15 05:55:45 mrg Exp $");
+__RCSID("$NetBSD: ldd.c,v 1.27 2022/10/18 19:04:57 mrg Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -185,13 +185,14 @@ main(int argc, char **argv)
 		}
 		/* Alpha never had 32 bit support. */
 #if (defined(_LP64) && !defined(ELF64_ONLY)) || defined(MIPS_N32)
-		if (elf32_ldd(fd, *argv, path, fmt1, fmt2) == -1) {
+		if (failed && elf32_ldd(fd, *argv, path, fmt1, fmt2) == -1) {
 			if (verbose)
 				warnx("%s", error_message);
 			failed = true;
 		}
 #if defined(__mips__) && 0 /* XXX this is still hosed for some reason */
-		if (elf32_ldd_compat(fd, *argv, path, fmt1, fmt2) == -1) {
+		if (failed &&
+		    elf32_ldd_compat(fd, *argv, path, fmt1, fmt2) == -1) {
 			if (verbose)
 				warnx("%s", error_message);
 			failed = true;

Reply via email to