Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Oct 2017 11:16:38 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r324950 - head/libexec/rtld-elf
Message-ID:  <201710241116.v9OBGcq8010914@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Tue Oct 24 11:16:38 2017
New Revision: 324950
URL: https://svnweb.freebsd.org/changeset/base/324950

Log:
  Reword the conditional; it was ugly, and adding another parameter,
  which I'm going to do in a subsequent commit, would make it even uglier.
  No functional changes.
  
  MFC after:	2 weeks
  Sponsored by:	DARPA, AFRL

Modified:
  head/libexec/rtld-elf/rtld.c

Modified: head/libexec/rtld-elf/rtld.c
==============================================================================
--- head/libexec/rtld-elf/rtld.c	Tue Oct 24 10:48:26 2017	(r324949)
+++ head/libexec/rtld-elf/rtld.c	Tue Oct 24 11:16:38 2017	(r324950)
@@ -1620,27 +1620,54 @@ find_library(const char *xname, const Obj_Entry *refob
      * nodeflib.
      */
     if (objgiven && refobj->rpath != NULL && ld_library_path_rpath) {
-	if ((pathname = search_library_path(name, ld_library_path)) != NULL ||
-	  (refobj != NULL &&
-	  (pathname = search_library_path(name, refobj->rpath)) != NULL) ||
-	  (pathname = search_library_pathfds(name, ld_library_dirs, fdp)) != NULL ||
-          (pathname = search_library_path(name, gethints(false))) != NULL ||
-	  (pathname = search_library_path(name, ld_standard_library_path)) != NULL)
+	pathname = search_library_path(name, ld_library_path);
+	if (pathname != NULL)
 	    return (pathname);
+	if (refobj != NULL) {
+	    pathname = search_library_path(name, refobj->rpath);
+	    if (pathname != NULL)
+	      return (pathname);
+	}
+	pathname = search_library_pathfds(name, ld_library_dirs, fdp);
+	if (pathname != NULL)
+	    return (pathname);
+	pathname = search_library_path(name, gethints(false));
+	if (pathname != NULL)
+	    return (pathname);
+	pathname = search_library_path(name, ld_standard_library_path);
+	if (pathname != NULL)
+	    return (pathname);
     } else {
 	nodeflib = objgiven ? refobj->z_nodeflib : false;
-	if ((objgiven &&
-	  (pathname = search_library_path(name, refobj->rpath)) != NULL) ||
-	  (objgiven && refobj->runpath == NULL && refobj != obj_main &&
-	  (pathname = search_library_path(name, obj_main->rpath)) != NULL) ||
-	  (pathname = search_library_path(name, ld_library_path)) != NULL ||
-	  (objgiven &&
-	  (pathname = search_library_path(name, refobj->runpath)) != NULL) ||
-	  (pathname = search_library_pathfds(name, ld_library_dirs, fdp)) != NULL ||
-	  (pathname = search_library_path(name, gethints(nodeflib))) != NULL ||
-	  (objgiven && !nodeflib &&
-	  (pathname = search_library_path(name, ld_standard_library_path)) != NULL))
+	if (objgiven) {
+	    pathname = search_library_path(name, refobj->rpath);
+	    if (pathname != NULL)
+		return (pathname);
+	}
+	if (objgiven && refobj->runpath == NULL && refobj != obj_main) {
+	    pathname = search_library_path(name, obj_main->rpath);
+	    if (pathname != NULL)
+		return (pathname);
+	}
+	pathname = search_library_path(name, ld_library_path);
+	if (pathname != NULL)
 	    return (pathname);
+	if (objgiven) {
+	    pathname = search_library_path(name, refobj->runpath);
+	    if (pathname != NULL)
+		return (pathname);
+	}
+	pathname = search_library_pathfds(name, ld_library_dirs, fdp);
+	if (pathname != NULL)
+	    return (pathname);
+	pathname = search_library_path(name, gethints(nodeflib));
+	if (pathname != NULL)
+	    return (pathname);
+	if (objgiven && !nodeflib) {
+	    pathname = search_library_path(name, ld_standard_library_path);
+	    if (pathname != NULL)
+		return (pathname);
+	}
     }
 
     if (objgiven && refobj->path != NULL) {



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