aboutsummaryrefslogtreecommitdiff
path: root/elf/dl-load.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-09-02 12:58:42 +0000
committerUlrich Drepper <drepper@redhat.com>1998-09-02 12:58:42 +0000
commit143e2b96c94c3fd5a2c618db0bad094ce659e743 (patch)
treeeea1289a952261584269f3ffeadf4137a1924706 /elf/dl-load.c
parent4ce636da6cf71061410da841e12b27b5f551e879 (diff)
downloadglibc-143e2b96c94c3fd5a2c618db0bad094ce659e743.tar
glibc-143e2b96c94c3fd5a2c618db0bad094ce659e743.tar.gz
glibc-143e2b96c94c3fd5a2c618db0bad094ce659e743.tar.bz2
glibc-143e2b96c94c3fd5a2c618db0bad094ce659e743.zip
Update.
1998-09-02 Ulrich Drepper <drepper@cygnus.com> * elf/dl-load.c (fillin_rpath): Handle "/" as RPATH correctly. (_dl_map_object_from_fd): Make NAME argument const. Remove last parameter in _dl_new_object call. (print_search_path): Correct construction of composed path name. (_dl_map_object): Prevent looking at RPATH of the main map twice. Remove last parameter in _dl_new_object call. * elf/dl-object.c: Remove last parameter. Determine whether create origin entry based on empty realname. Handle file in root directory correctly. * elf/ldsodefs.h: Adjust prototype for _dl_new_object. * elf/rtld.c (dl_main): Add comment describing reason for memory leak. Remove last parameter in _dl_new_object call. * sysdeps/generic/dl-origin.h: Handle file in root directory correctly. * sysdeps/unix/sysv/linux/dl-origin.h: Likewise.
Diffstat (limited to 'elf/dl-load.c')
-rw-r--r--elf/dl-load.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index cb718eb2c6..c9a39c01a2 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -297,7 +297,7 @@ fillin_rpath (char *rpath, struct r_search_path_elem **result, const char *sep,
cp = strcpy (curwd, ".");
}
- /* Remove trailing slashes. */
+ /* Remove trailing slashes (except for "/"). */
while (len > 1 && cp[len - 1] == '/')
--len;
@@ -321,8 +321,8 @@ fillin_rpath (char *rpath, struct r_search_path_elem **result, const char *sep,
continue;
}
- /* Now add one. */
- if (len > 0)
+ /* Now add one if there is none so far. */
+ if (len > 0 && cp[len - 1] != '/')
cp[len++] = '/';
/* See if this directory is already known. */
@@ -609,7 +609,7 @@ _dl_init_paths (const char *llp)
static
#endif
struct link_map *
-_dl_map_object_from_fd (char *name, int fd, char *realname,
+_dl_map_object_from_fd (const char *name, int fd, char *realname,
struct link_map *loader, int l_type)
{
struct link_map *l = NULL;
@@ -727,7 +727,7 @@ _dl_map_object_from_fd (char *name, int fd, char *realname,
#endif
/* Enter the new object in the list of loaded objects. */
- l = _dl_new_object (realname, name, l_type, loader != NULL);
+ l = _dl_new_object (realname, name, l_type);
if (! l)
lose (ENOMEM, "cannot create shared object descriptor");
l->l_opencount = 1;
@@ -995,7 +995,10 @@ print_search_path (struct r_search_path_elem **list,
if ((*list)->status[cnt] != nonexisting)
{
char *cp = __mempcpy (endp, capstr[cnt].str, capstr[cnt].len);
- cp[-1] = '\0';
+ if (cp == buf || (cp == buf + 1 && buf[0] == '/'))
+ cp[0] = '\0';
+ else
+ cp[-1] = '\0';
_dl_debug_message (0, first ? "" : ":", buf, NULL);
first = 0;
}
@@ -1211,7 +1214,7 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
/* If dynamically linked, try the DT_RPATH of the executable itself
and the LD_LIBRARY_PATH environment variable. */
l = _dl_loaded;
- if (fd == -1 && l && l->l_type != lt_loaded
+ if (fd == -1 && l && l->l_type != lt_loaded && l != loader
&& l->l_rpath_dirs != (struct r_search_path_elem **) -1l)
fd = open_path (name, namelen, preloaded, l->l_rpath_dirs, &realname);
@@ -1277,8 +1280,7 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
/* Enter the new object in the list of loaded objects. */
if ((name_copy = local_strdup (name)) == NULL
- || (l = _dl_new_object (name_copy, name, type,
- loader != NULL)) == NULL)
+ || (l = _dl_new_object (name_copy, name, type)) == NULL)
_dl_signal_error (ENOMEM, name,
"cannot create shared object descriptor");
/* We use an opencount of 0 as a sign for the faked entry. */