summaryrefslogtreecommitdiffstats
path: root/libexec/rtld-aout
diff options
context:
space:
mode:
authorjdp <jdp@FreeBSD.org>1996-04-20 18:27:56 +0000
committerjdp <jdp@FreeBSD.org>1996-04-20 18:27:56 +0000
commit442c49eed881daec1430fe104b241beeb6d2de00 (patch)
treebda8f3491765b68ae27049b99961acce3ed62cdc /libexec/rtld-aout
parent45c2d4f4f6ccd3b2d6abb50730b67a7f6c1aeeea (diff)
downloadFreeBSD-src-442c49eed881daec1430fe104b241beeb6d2de00.zip
FreeBSD-src-442c49eed881daec1430fe104b241beeb6d2de00.tar.gz
Implement support for LD_PRELOAD in the dynamic linker.
Submitted by: Doug Ambrisko <ambrisko@ambrisko.roble.com>
Diffstat (limited to 'libexec/rtld-aout')
-rw-r--r--libexec/rtld-aout/shlib.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/libexec/rtld-aout/shlib.c b/libexec/rtld-aout/shlib.c
index 04af10a..9460d35 100644
--- a/libexec/rtld-aout/shlib.c
+++ b/libexec/rtld-aout/shlib.c
@@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: shlib.c,v 1.13 1995/03/19 21:20:09 nate Exp $
+ * $Id: shlib.c,v 1.14 1996/01/13 00:14:53 jdp Exp $
*/
#include <sys/param.h>
@@ -204,6 +204,32 @@ int do_dot_a;
}
/*
+ * Search library directories for a file with the given name. The
+ * return value is a full pathname to the matching file. The string
+ * is dynamically allocated. If no matching file is found, the function
+ * returns NULL.
+ */
+
+char *
+find_lib_file(name)
+ char *name;
+{
+ int i;
+
+ for (i = 0; i < n_search_dirs; i++) {
+ char *path = concat(search_dirs[i], "/", name);
+ struct stat sb;
+
+ if (lstat(path, &sb) != -1) /* We found it */
+ return path;
+
+ free(path);
+ }
+
+ return NULL;
+}
+
+/*
* Search a given directory for a library (preferably shared) satisfying
* the given criteria.
*
OpenPOWER on IntegriCloud