1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00

Mon Jun 3 21:03:54 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>

* malloc/mcheck.c (freehook, reallochook): Handle null pointer args.

	* hurd/hurdsig.c (_hurd_internal_post_signal): When setting ACT to
	`ignore, resume the thread if SS_SUSPENDED, regardless of old action.

Sun Jun  2 20:14:30 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* locale/programs/linereader.c (lr_open): Don't pass NULL to
	xstrdup; fix memory leak.
	(lr_close): Fix memory leak.

	* hurd/hurdsig.c (_hurd_internal_post_signal): When turning the action
Mon Jun  3 01:29:53 1996  Roland McGrath  <roland@delasyd.gnu.ai.mit.edu>

	* elf/link.h (struct link_map): Replace l_deps_loaded flag member with
	`struct link_map **l_searchlist'.
	* elf/dl-lookup.c (_dl_lookup_symbol): Make SYMBOL_SCOPE arg an array
	of two link_map ptrs.  Search the maps in the l_searchlist of each
	of the two elts that is non-null.
	* elf/dl-reloc.c (_dl_relocate_object): Pass proper SCOPE array.
	* elf/dl-runtime.c: Likewise.
	* elf/dlsym.c: Likewise.
	* elf/rtld.c (dl_main): Likewise.
This commit is contained in:
Roland McGrath
1996-06-03 22:46:17 +00:00
parent 20328c3962
commit 5f2eab4263
6 changed files with 213 additions and 19 deletions

View File

@ -1,13 +1,39 @@
Mon Jun 3 21:03:54 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* malloc/mcheck.c (freehook, reallochook): Handle null pointer args.
* hurd/hurdsig.c (_hurd_internal_post_signal): When setting ACT to
`ignore, resume the thread if SS_SUSPENDED, regardless of old action.
Sun Jun 2 20:14:30 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* locale/programs/linereader.c (lr_open): Don't pass NULL to
xstrdup; fix memory leak.
(lr_close): Fix memory leak.
Mon Jun 3 15:58:22 1996 Michael I. Bushnell, p/BSG <mib@gnu.ai.mit.edu> Mon Jun 3 15:58:22 1996 Michael I. Bushnell, p/BSG <mib@gnu.ai.mit.edu>
* hurdsig.c (_hurd_internal_post_signal): When turning the action * hurd/hurdsig.c (_hurd_internal_post_signal): When turning the action
for a HANDLE signal to IGNORE because the signal is blocked, clean for a HANDLE signal to IGNORE because the signal is blocked, clean
up any pending suspension left over from a call to resume. up any pending suspension left over from a call to resume.
Mon Jun 3 01:29:53 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* elf/link.h (struct link_map): Replace l_deps_loaded flag member with
`struct link_map **l_searchlist'.
* elf/dl-lookup.c (_dl_lookup_symbol): Make SYMBOL_SCOPE arg an array
of two link_map ptrs. Search the maps in the l_searchlist of each
of the two elts that is non-null.
* elf/dl-reloc.c (_dl_relocate_object): Pass proper SCOPE array.
* elf/dl-runtime.c: Likewise.
* elf/dlsym.c: Likewise.
* elf/rtld.c (dl_main): Likewise.
Mon Jun 3 00:30:35 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> Mon Jun 3 00:30:35 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* elf/dl-lookup.c (_dl_lookup_symbol): Take new arg RELOC_ADDR and * elf/dl-lookup.c (_dl_lookup_symbol): Take new arg RELOC_ADDR and
don't allow a defn resolving to that address. don't allow a defn resolving to that address.
* elf/link.h: Update prototype and comment. * elf/link.h: Update prototype and comment.
* elf/dl-runtime.c (fixup): Define local `resolve' function and pass * elf/dl-runtime.c (fixup): Define local `resolve' function and pass
it to elf_machine_relplt. it to elf_machine_relplt.

View File

@ -680,7 +680,7 @@ _hurd_internal_post_signal (struct hurd_sigstate *ss,
/* If there was a call to resume above in SIGCONT processing /* If there was a call to resume above in SIGCONT processing
and we've left a thread suspended, now's the time to and we've left a thread suspended, now's the time to
set it going. */ set it going. */
if (act == handle && ss_suspended) if (ss_suspended)
{ {
err = __thread_resume (ss->thread); err = __thread_resume (ss->thread);
assert_perror (err); assert_perror (err);

View File

@ -1,6 +1,8 @@
/* dcgettext.c -- implementation of the dcgettext(3) function /* dcgettext.c -- implementation of the dcgettext(3) function
Copyright (C) 1995, 1996 Free Software Foundation, Inc. Copyright (C) 1995, 1996 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as modify it under the terms of the GNU Library General Public License as
@ -14,8 +16,8 @@ Library General Public License for more details.
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Boston, MA 02111-1307, USA. */ Cambridge, MA 02139, USA. */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
@ -160,6 +162,42 @@ static const char *guess_category_value PARAMS ((int category,
const char *categoryname)); const char *categoryname));
/* For those loosing systems which don't have `alloca' we have to add
some additional code emulating it. */
#ifdef HAVE_ALLOCA
/* Nothing has to be done. */
# define ADD_BLOCK(list, address) /* nothing */
# define FREE_BLOCKS(list) /* nothing */
#else
struct block_list
{
void *address;
struct block_list *next;
};
# define ADD_BLOCK(list, addr) \
do { \
struct block_list *newp = (struct block_list *) malloc (sizeof (*newp)); \
/* If we cannot get a free block we cannot add the new element to \
the list. */ \
if (newp != NULL) { \
newp->address = (addr); \
newp->next = (list); \
(list) = newp; \
} \
} while (0)
# define FREE_BLOCKS(list) \
do { \
while (list != NULL) { \
struct block_list *old = list; \
list = list->next; \
free (old); \
} \
} while (0)
# undef alloca
# define alloca(size) (malloc (size))
#endif /* have alloca */
/* Names for the libintl functions are a problem. They must not clash /* Names for the libintl functions are a problem. They must not clash
with existing names and they should follow ANSI C. But this source with existing names and they should follow ANSI C. But this source
code is also used in GNU C Library where the names have a __ code is also used in GNU C Library where the names have a __
@ -178,6 +216,9 @@ DCGETTEXT (domainname, msgid, category)
const char *msgid; const char *msgid;
int category; int category;
{ {
#ifndef HAVE_ALLOCA
struct block_list *alloca_list = NULL;
#endif
struct loaded_l10nfile *domain; struct loaded_l10nfile *domain;
struct binding *binding; struct binding *binding;
const char *categoryname; const char *categoryname;
@ -227,12 +268,14 @@ DCGETTEXT (domainname, msgid, category)
path_max += 2; /* The getcwd docs say to do this. */ path_max += 2; /* The getcwd docs say to do this. */
dirname = (char *) alloca (path_max + dirname_len); dirname = (char *) alloca (path_max + dirname_len);
ADD_BLOCK (block_list, dirname);
errno = 0; errno = 0;
while ((ret = getcwd (dirname, path_max)) == NULL && errno == ERANGE) while ((ret = getcwd (dirname, path_max)) == NULL && errno == ERANGE)
{ {
path_max += PATH_INCR; path_max += PATH_INCR;
dirname = (char *) alloca (path_max + dirname_len); dirname = (char *) alloca (path_max + dirname_len);
ADD_BLOCK (block_list, dirname);
errno = 0; errno = 0;
} }
@ -240,6 +283,7 @@ DCGETTEXT (domainname, msgid, category)
{ {
/* We cannot get the current working directory. Don't signal an /* We cannot get the current working directory. Don't signal an
error but simply return the default string. */ error but simply return the default string. */
FREE_BLOCKS (block_list);
errno = saved_errno; errno = saved_errno;
return (char *) msgid; return (char *) msgid;
} }
@ -262,6 +306,7 @@ DCGETTEXT (domainname, msgid, category)
xdomainname = (char *) alloca (strlen (categoryname) xdomainname = (char *) alloca (strlen (categoryname)
+ strlen (domainname) + 5); + strlen (domainname) + 5);
ADD_BLOCK (block_list, xdomainname);
/* We don't want libintl.a to depend on any other library. So we /* We don't want libintl.a to depend on any other library. So we
avoid the non-standard function stpcpy. In GNU C Library this avoid the non-standard function stpcpy. In GNU C Library this
function is available, though. Also allow the symbol HAVE_STPCPY function is available, though. Also allow the symbol HAVE_STPCPY
@ -279,6 +324,7 @@ DCGETTEXT (domainname, msgid, category)
/* Creating working area. */ /* Creating working area. */
single_locale = (char *) alloca (strlen (categoryvalue) + 1); single_locale = (char *) alloca (strlen (categoryvalue) + 1);
ADD_BLOCK (block_list, single_locale);
/* Search for the given string. This is a loop because we perhaps /* Search for the given string. This is a loop because we perhaps
@ -310,6 +356,7 @@ DCGETTEXT (domainname, msgid, category)
if (strcmp (single_locale, "C") == 0 if (strcmp (single_locale, "C") == 0
|| strcmp (single_locale, "POSIX") == 0) || strcmp (single_locale, "POSIX") == 0)
{ {
FREE_BLOCKS (block_list);
errno = saved_errno; errno = saved_errno;
return (char *) msgid; return (char *) msgid;
} }
@ -338,6 +385,7 @@ DCGETTEXT (domainname, msgid, category)
if (retval != NULL) if (retval != NULL)
{ {
FREE_BLOCKS (block_list);
errno = saved_errno; errno = saved_errno;
return retval; return retval;
} }

View File

@ -1,7 +1,9 @@
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc. /* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
@ -14,16 +16,83 @@ Library General Public License for more details.
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Boston, MA 02111-1307, USA. */ Cambridge, MA 02139, USA. */
#if defined _LIBC && (defined __ARGZ_COUNT || defined __ARGZ_STRINGIFY)
# include <argz.h> # include <argz.h>
#endif
#include <ctype.h> #include <ctype.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "loadinfo.h" #include "loadinfo.h"
/* Define function which are usually not available. */
#if !defined _LIBC && !defined __ARGZ_COUNT
/* Returns the number of strings in ARGZ. */
static size_t __argz_count __P ((const char *argz, size_t len));
static size_t
__argz_count (argz, len)
const char *argz;
size_t len;
{
size_t count = 0;
while (len > 0)
{
size_t part_len = strlen(argz);
argz += part_len + 1;
len -= part_len + 1;
count++;
}
return count;
}
#endif /* !_LIBC && !__ARGZ_COUNT */
#if !defined _LIBC && !defined __ARGZ_STRINGIFY
/* Make '\0' separated arg vector ARGZ printable by converting all the '\0's
except the last into the character SEP. */
static void __argz_stringify __P ((char *argz, size_t len, int sep));
static void
__argz_stringify (argz, len, sep)
char *argz;
size_t len;
int sep;
{
while (len > 0)
{
size_t part_len = strlen(argz);
argz += part_len;
len -= part_len + 1;
if (len > 0)
*argz++ = sep;
}
}
#endif /* !_LIBC && !__ARGZ_COUNT */
#if !defined _LIBC && !defined __ARGZ_NEXT
static char *
__argz_next (char *argz, size_t argz_len, const char *entry)
{
if (entry)
{
if (entry < argz + argz_len)
entry = strchr (entry, '\0') + 1;
return entry >= argz + argz_len ? NULL : (char *) entry;
}
else
if (argz_len > 0)
return argz;
else
return 0;
}
#endif
/* Return number of bits set in X. */ /* Return number of bits set in X. */
static int pop __P ((int x)); static int pop __P ((int x));
@ -40,7 +109,7 @@ pop (x)
return x; return x;
} }
struct loaded_l10nfile * struct loaded_l10nfile *
_nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language, _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language,
territory, codeset, normalized_codeset, modifier, special, territory, codeset, normalized_codeset, modifier, special,

View File

@ -1,6 +1,8 @@
/* loadmsgcat.c -- load needed message catalogs /* loadmsgcat.c -- load needed message catalogs
Copyright (C) 1995, 1996 Free Software Foundation, Inc. Copyright (C) 1995, 1996 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as modify it under the terms of the GNU Library General Public License as
@ -14,8 +16,8 @@ Library General Public License for more details.
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Boston, MA 02111-1307, USA. */ Cambridge, MA 02139, USA. */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
@ -160,7 +162,7 @@ _nl_load_domain (domain_file)
} }
domain_file->data domain_file->data
= (struct loaded_domain *) malloc (sizeof (struct loaded_domain *)); = (struct loaded_domain *) malloc (sizeof (struct loaded_domain));
if (domain_file->data == NULL) if (domain_file->data == NULL)
return; return;

View File

@ -77,6 +77,41 @@ void free ();
# define strcasecmp __strcasecmp # define strcasecmp __strcasecmp
#endif #endif
/* For those loosing systems which don't have `alloca' we have to add
some additional code emulating it. */
#ifdef HAVE_ALLOCA
/* Nothing has to be done. */
# define ADD_BLOCK(list, address) /* nothing */
# define FREE_BLOCKS(list) /* nothing */
#else
struct block_list
{
void *address;
struct block_list *next;
};
# define ADD_BLOCK(list, addr) \
do { \
struct block_list *newp = (struct block_list *) malloc (sizeof (*newp)); \
/* If we cannot get a free block we cannot add the new element to \
the list. */ \
if (newp != NULL) { \
newp->address = (addr); \
newp->next = (list); \
(list) = newp; \
} \
} while (0)
# define FREE_BLOCKS(list) \
do { \
while (list != NULL) { \
struct block_list *old = list; \
list = list->next; \
free (old); \
} \
} while (0)
#endif /* have alloca */
struct alias_map struct alias_map
{ {
const char *alias; const char *alias;
@ -151,18 +186,25 @@ read_alias_file (fname, fname_len)
const char *fname; const char *fname;
int fname_len; int fname_len;
{ {
#ifndef HAVE_ALLOCA
struct block_list *alloca_list = NULL;
#endif
FILE *fp; FILE *fp;
char *full_fname; char *full_fname;
size_t added; size_t added;
static const char aliasfile[] = "/locale.alias"; static const char aliasfile[] = "/locale.alias";
full_fname = (char *) alloca (fname_len + sizeof aliasfile); full_fname = (char *) alloca (fname_len + sizeof aliasfile);
ADD_BLOCK (block_list, full_fname);
memcpy (full_fname, fname, fname_len); memcpy (full_fname, fname, fname_len);
memcpy (&full_fname[fname_len], aliasfile, sizeof aliasfile); memcpy (&full_fname[fname_len], aliasfile, sizeof aliasfile);
fp = fopen (full_fname, "r"); fp = fopen (full_fname, "r");
if (fp == NULL) if (fp == NULL)
{
FREE_BLOCKS (block_list);
return 0; return 0;
}
added = 0; added = 0;
while (!feof (fp)) while (!feof (fp))
@ -227,14 +269,20 @@ read_alias_file (fname, fname_len)
len = strlen (alias) + 1; len = strlen (alias) + 1;
tp = (char *) malloc (len); tp = (char *) malloc (len);
if (tp == NULL) if (tp == NULL)
{
FREE_BLOCKS (block_list);
return added; return added;
}
memcpy (tp, alias, len); memcpy (tp, alias, len);
map[nmap].alias = tp; map[nmap].alias = tp;
len = strlen (value) + 1; len = strlen (value) + 1;
tp = (char *) malloc (len); tp = (char *) malloc (len);
if (tp == NULL) if (tp == NULL)
{
FREE_BLOCKS (block_list);
return added; return added;
}
memcpy (tp, value, len); memcpy (tp, value, len);
map[nmap].value = tp; map[nmap].value = tp;
@ -263,6 +311,7 @@ read_alias_file (fname, fname_len)
qsort (map, nmap, sizeof (struct alias_map), qsort (map, nmap, sizeof (struct alias_map),
(int (*) PARAMS ((const void *, const void *))) alias_compare); (int (*) PARAMS ((const void *, const void *))) alias_compare);
FREE_BLOCKS (block_list);
return added; return added;
} }