aboutsummaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-08-29 01:20:23 +0000
committerUlrich Drepper <drepper@redhat.com>2000-08-29 01:20:23 +0000
commit04ea3b0fbb9ca56a04b437c57c2878842d331c77 (patch)
tree3f03f09731b5185c8a25609af1507866ca5783e9 /elf
parent50fd913bece94eba2aa8394b1b6958708e4dcd4d (diff)
downloadglibc-04ea3b0fbb9ca56a04b437c57c2878842d331c77.zip
glibc-04ea3b0fbb9ca56a04b437c57c2878842d331c77.tar.gz
glibc-04ea3b0fbb9ca56a04b437c57c2878842d331c77.tar.bz2
Update.
2000-08-27 Bruno Haible <haible@clisp.cons.org> * string/strxfrm.c (strxfrm, wcsxfrm): Include <sys/param.h>. If nrules == 0 and srclen < n, copy only srclen + 1 characters. * sysdeps/generic/getdomain.c (getdomainname): Include <sys/param.h>. If the result is fits in the buffer, copy only as many bytes as needed. * sysdeps/generic/_strerror.c (__strerror_r): Don't zero-fill the buffer after copying numbuf into it. * sysdeps/mach/_strerror.c (__strerror_r): Likewise. 2000-08-27 Bruno Haible <haible@clisp.cons.org> * posix/confstr.c (confstr): When string_len > len, NUL-terminate the result. When string_len < len, don't clear the rest of the buffer. 2000-08-27 Bruno Haible <haible@clisp.cons.org> Support for new LC_COLLATE format. * locale/coll-lookup.h: New file. * locale/weightwc.h (findidx): When size == 0, call collidx_table_lookup. * wcsmbs/wcscoll.c: Include coll-lookup.h. * wcsmbs/wcsxfrm.c: Likewise. * posix/fnmatch.c: Likewise. * posix/fnmatch_loop.c (internal_fnwmatch): When size == 0, call collseq_table_lookup. * locale/programs/3level.h: New file. * locale/programs/ld-ctype.c: (wcwidth_table, wctrans_table): Define by including "3level.h". * locale/programs/ld-collate.c (wchead_table, collidx_table, collseq_table): New types, defined by including "3level.h". (locale_collate_t): New wcheads_3level, wcseqorder_3level fields. (encoding_mask, encoding_byte): Remove. (utf8_encode): Use simple shifts instead. (collate_finish): When !oldstyle_tables, set plane_size and plane_cnt to 0, and initialize and fill wcheads_3level and wcseqorder_3level. (collate_output): New local variable tablewc_3level. When !oldstyle_tables, set table_size to 0 and names to NULL and fill tablewc_3level instead of tablewc. Change format of TABLEWC and COLLSEQWC entries written to the file. * locale/C-collate.c (collseqwc): Change format. (_nl_C_LC_COLLATE): Set HASH_SIZE and HASH_LAYERS to 0, change format of COLLSEQWC. * locale/Makefile (distribute): Add coll-lookup.h, programs/3level.h. 2000-08-27 Bruno Haible <haible@clisp.cons.org> * locale/programs/ld-ctype.c (MAX_CHARNAMES_IDX): New macro. (locale_ctype_t): New charnames_idx field. (ctype_startup): Initialize charnames_idx field. (find_idx): Speed up dramatically by using charnames_idx inverse table. 2000-08-27 Bruno Haible <haible@clisp.cons.org> * locale/C-ctype.c: Switch to new locale format. (_nl_C_LC_CTYPE_names): Remove array. (STRUCT_CTYPE_CLASS): New macro. (_nl_C_LC_CTYPE_class_{upper,lower,alpha,digit,xdigit,space,print, graph,blank,cntrl,punct,alnum}, _nl_C_LC_CTYPE_map_{toupper,tolower}): New three-level tables. (_nl_C_LC_CTYPE_width): Change from array to three-level table. (_nl_C_LC_CTYPE): Fix nstrings value. Set HASH_SIZE and HASH_LAYERS to 0. Change WIDTH format. Set CLASS_OFFSET and MAP_OFFSET. Add 12 class tables and 2 map tables at the end. * ctype/ctype-info.c (_nl_C_LC_CTYPE_names): Remove declaration. (_nl_C_LC_CTYPE_class_{upper,lower,alpha,digit,xdigit,space,print, graph,blank,cntrl,punct,alnum}, _nl_C_LC_CTYPE_map_{toupper,tolower}): New declarations. (b): Remove trailing semicolon. (__ctype_names, __ctype_width): Don't initialize. (__ctype32_wctype, __ctype32_wctrans, __ctype32_width): Initialize. 2000-08-27 Bruno Haible <haible@clisp.cons.org> * elf/dl-load.c (open_path): Add a argument telling whether *dirsp is guaranteed to be allocated with the same malloc() and may be passed to free(). (_dl_map_object): Update open_path calls. If rtld_search_dirs has been set to empty by an earlier open_path call, don't pass it again.
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-load.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index ea3c928..2c1f2a5 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1204,13 +1204,16 @@ print_search_path (struct r_search_path_elem **list,
_dl_debug_message (0, "\t\t(", what, ")\n", NULL);
}
-/* Try to open NAME in one of the directories in DIRS.
+/* Try to open NAME in one of the directories in *DIRSP.
Return the fd, or -1. If successful, fill in *REALNAME
- with the malloc'd full directory name. */
+ with the malloc'd full directory name. If it turns out
+ that none of the directories in *DIRSP exists, *DIRSP is
+ replaced with (void *) -1, and the old value is free()d
+ if MAY_FREE_DIRS is true. */
static int
open_path (const char *name, size_t namelen, int preloaded,
- struct r_search_path_elem ***dirsp,
+ struct r_search_path_elem ***dirsp, int may_free_dirs,
char **realname)
{
struct r_search_path_elem **dirs = *dirsp;
@@ -1325,7 +1328,10 @@ open_path (const char *name, size_t namelen, int preloaded,
/* Remove the whole path if none of the directories exists. */
if (! any)
{
- free (*dirsp);
+ /* Paths which were allocated using the minimal malloc() in ld.so
+ must not be freed using the general free() in libc. */
+ if (may_free_dirs)
+ free (*dirsp);
*dirsp = (void *) -1;
}
@@ -1414,12 +1420,12 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
if (l->l_rpath_dirs != (void *) -1)
fd = open_path (name, namelen, preloaded,
- &l->l_rpath_dirs, &realname);
+ &l->l_rpath_dirs, 1, &realname);
}
}
else if (l->l_rpath_dirs != (void *) -1)
fd = open_path (name, namelen, preloaded, &l->l_rpath_dirs,
- &realname);
+ 0, &realname);
}
/* If dynamically linked, try the DT_RPATH of the executable
@@ -1427,13 +1433,14 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
l = _dl_loaded;
if (fd == -1 && l && l->l_type != lt_loaded && l != loader
&& l->l_rpath_dirs != (void *) -1)
- fd = open_path (name, namelen, preloaded, &l->l_rpath_dirs,
+ fd = open_path (name, namelen, preloaded, &l->l_rpath_dirs, 0,
&realname);
}
/* Try the LD_LIBRARY_PATH environment variable. */
if (fd == -1 && env_path_list != (void *) -1)
- fd = open_path (name, namelen, preloaded, &env_path_list, &realname);
+ fd = open_path (name, namelen, preloaded, &env_path_list, 0,
+ &realname);
/* Look at the RUNPATH informaiton for this binary. */
if (loader != NULL && loader->l_runpath_dirs != (void *) -1)
@@ -1453,12 +1460,12 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
if (loader->l_runpath_dirs != (void *) -1)
fd = open_path (name, namelen, preloaded,
- &loader->l_runpath_dirs, &realname);
+ &loader->l_runpath_dirs, 1, &realname);
}
}
else if (loader->l_runpath_dirs != (void *) -1)
fd = open_path (name, namelen, preloaded,
- &loader->l_runpath_dirs, &realname);
+ &loader->l_runpath_dirs, 0, &realname);
}
if (fd == -1)
@@ -1518,8 +1525,9 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
/* Finally, try the default path. */
if (fd == -1
&& (l == NULL ||
- __builtin_expect (!(l->l_flags_1 & DF_1_NODEFLIB), 1)))
- fd = open_path (name, namelen, preloaded, &rtld_search_dirs,
+ __builtin_expect (!(l->l_flags_1 & DF_1_NODEFLIB), 1))
+ && rtld_search_dirs != (void *) -1)
+ fd = open_path (name, namelen, preloaded, &rtld_search_dirs, 0,
&realname);
/* Add another newline when we a tracing the library loading. */