From 143e2b96c94c3fd5a2c618db0bad094ce659e743 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 2 Sep 1998 12:58:42 +0000 Subject: Update. 1998-09-02 Ulrich Drepper * 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. --- sysdeps/generic/dl-origin.h | 4 ++-- sysdeps/unix/sysv/linux/dl-origin.h | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'sysdeps') diff --git a/sysdeps/generic/dl-origin.h b/sysdeps/generic/dl-origin.h index 6d5a8da..495df60 100644 --- a/sysdeps/generic/dl-origin.h +++ b/sysdeps/generic/dl-origin.h @@ -26,7 +26,7 @@ static inline const char * get_origin (void) { char *result = (char *) -1; - /* We use te environment variable LD_ORIGIN_PATH. If it is set make + /* We use the environment variable LD_ORIGIN_PATH. If it is set make a copy and strip out trailing slashes. */ if (_dl_origin_path != NULL) { @@ -37,7 +37,7 @@ get_origin (void) else { char *cp = __mempcpy (result, _dl_origin_path, len); - while (cp > result && cp[-1] == '/') + while (cp > result + 1 && cp[-1] == '/') --cp; *cp = '\0'; } diff --git a/sysdeps/unix/sysv/linux/dl-origin.h b/sysdeps/unix/sysv/linux/dl-origin.h index f5a9237..5654b42 100644 --- a/sysdeps/unix/sysv/linux/dl-origin.h +++ b/sysdeps/unix/sysv/linux/dl-origin.h @@ -37,13 +37,15 @@ get_origin (void) result = (char *) malloc (last_slash - linkval + 1); if (result == NULL) result = (char *) -1; + else if (last_slash == linkval) + memcpy (result, "/", 2); else *((char *) __mempcpy (result, linkval, last_slash - linkval)) = '\0'; } else { result = (char *) -1; - /* We use te environment variable LD_ORIGIN_PATH. If it is set make + /* We use the environment variable LD_ORIGIN_PATH. If it is set make a copy and strip out trailing slashes. */ if (_dl_origin_path != NULL) { @@ -54,7 +56,7 @@ get_origin (void) else { char *cp = __mempcpy (result, _dl_origin_path, len); - while (cp > result && cp[-1] == '/') + while (cp > result + 1 && cp[-1] == '/') --cp; *cp = '\0'; } -- cgit v1.1