2002-04-14  Jakub Jelinek  <jakub@redhat.com>

	* elf/dl-lookup.c (_dl_lookup_symbol): Move add_dependency call to
	the end of the function.  Pass original flags to recursive call if
	add_dependency failed.
	(_dl_lookup_versioned_symbol): Likewise.

2002-04-13  Jakub Jelinek  <jakub@redhat.com>

	* time/mktime.c (__mktime_internal): If year is 69, don't bail out
	early, but check whether it overflowed afterwards.
	* time/tst-mktime.c (main): Add new tests.

	* debug/xtrace.sh: Fix program name in help message.
	Patch by Roger Luethi <rl@hellgate.ch>.
This commit is contained in:
Ulrich Drepper 2002-04-15 06:37:43 +00:00
parent fab656f5a7
commit 78575a842b
8 changed files with 115 additions and 49 deletions

View File

@ -1,5 +1,21 @@
2002-04-14 Jakub Jelinek <jakub@redhat.com>
* elf/dl-lookup.c (_dl_lookup_symbol): Move add_dependency call to
the end of the function. Pass original flags to recursive call if
add_dependency failed.
(_dl_lookup_versioned_symbol): Likewise.
2002-04-13 Jakub Jelinek <jakub@redhat.com>
* time/mktime.c (__mktime_internal): If year is 69, don't bail out
early, but check whether it overflowed afterwards.
* time/tst-mktime.c (main): Add new tests.
2002-04-14 Ulrich Drepper <drepper@redhat.com>
* debug/xtrace.sh: Fix program name in help message.
Patch by Roger Luethi <rl@hellgate.ch>.
* include/sys/stat.h: Add prototypes for __lxstat_internal and
__lxstat64_internal. Add macros __lxstat and __lxstat64 if not
NOT_IN_libc.

View File

@ -115,7 +115,7 @@ while test $# -gt 0; do
do_version
;;
--*)
echo >&2 $"memprof: unrecognized option \`$1'"
echo >&2 $"xtrace: unrecognized option \`$1'"
do_usage
;;
*)

View File

@ -228,24 +228,7 @@ _dl_lookup_symbol (const char *undef_name, struct link_map *undef_map,
for (scope = symbol_scope; *scope; ++scope)
if (do_lookup (undef_name, hash, *ref, &current_value, *scope, 0, flags,
NULL, type_class))
{
/* We have to check whether this would bind UNDEF_MAP to an object
in the global scope which was dynamically loaded. In this case
we have to prevent the latter from being unloaded unless the
UNDEF_MAP object is also unloaded. */
if (__builtin_expect (current_value.m->l_type == lt_loaded, 0)
/* Don't do this for explicit lookups as opposed to implicit
runtime lookups. */
&& (flags & DL_LOOKUP_ADD_DEPENDENCY) != 0
/* Add UNDEF_MAP to the dependencies. */
&& add_dependency (undef_map, current_value.m) < 0)
/* Something went wrong. Perhaps the object we tried to reference
was just removed. Try finding another definition. */
return INTUSE(_dl_lookup_symbol) (undef_name, undef_map, ref,
symbol_scope, type_class, 0);
break;
}
break;
if (__builtin_expect (current_value.s == NULL, 0))
{
@ -266,8 +249,8 @@ _dl_lookup_symbol (const char *undef_name, struct link_map *undef_map,
protected = *ref && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED;
if (__builtin_expect (protected != 0, 0))
{
/* It is very tricky. We need to figure out what value to
return for the protected symbol */
/* It is very tricky. We need to figure out what value to
return for the protected symbol. */
struct sym_val protected_value = { NULL, NULL };
for (scope = symbol_scope; *scope; ++scope)
@ -282,6 +265,21 @@ _dl_lookup_symbol (const char *undef_name, struct link_map *undef_map,
}
}
/* We have to check whether this would bind UNDEF_MAP to an object
in the global scope which was dynamically loaded. In this case
we have to prevent the latter from being unloaded unless the
UNDEF_MAP object is also unloaded. */
if (__builtin_expect (current_value.m->l_type == lt_loaded, 0)
/* Don't do this for explicit lookups as opposed to implicit
runtime lookups. */
&& (flags & DL_LOOKUP_ADD_DEPENDENCY) != 0
/* Add UNDEF_MAP to the dependencies. */
&& add_dependency (undef_map, current_value.m) < 0)
/* Something went wrong. Perhaps the object we tried to reference
was just removed. Try finding another definition. */
return INTUSE(_dl_lookup_symbol) (undef_name, undef_map, ref,
symbol_scope, type_class, flags);
if (__builtin_expect (GL(dl_debug_mask)
& (DL_DEBUG_BINDINGS|DL_DEBUG_PRELINK), 0))
_dl_debug_bindings (undef_name, undef_map, ref, symbol_scope,
@ -395,26 +393,7 @@ _dl_lookup_versioned_symbol (const char *undef_name,
int res = do_lookup_versioned (undef_name, hash, *ref, &current_value,
*scope, 0, version, NULL, type_class);
if (res > 0)
{
/* We have to check whether this would bind UNDEF_MAP to an object
in the global scope which was dynamically loaded. In this case
we have to prevent the latter from being unloaded unless the
UNDEF_MAP object is also unloaded. */
if (__builtin_expect (current_value.m->l_type == lt_loaded, 0)
/* Don't do this for explicit lookups as opposed to implicit
runtime lookups. */
&& flags != 0
/* Add UNDEF_MAP to the dependencies. */
&& add_dependency (undef_map, current_value.m) < 0)
/* Something went wrong. Perhaps the object we tried to reference
was just removed. Try finding another definition. */
return INTUSE(_dl_lookup_versioned_symbol) (undef_name, undef_map,
ref, symbol_scope,
version, type_class,
0);
break;
}
break;
if (__builtin_expect (res, 0) < 0)
{
@ -462,8 +441,8 @@ _dl_lookup_versioned_symbol (const char *undef_name,
if (__builtin_expect (protected != 0, 0))
{
/* It is very tricky. We need to figure out what value to
return for the protected symbol */
/* It is very tricky. We need to figure out what value to
return for the protected symbol. */
struct sym_val protected_value = { NULL, NULL };
for (scope = symbol_scope; *scope; ++scope)
@ -479,6 +458,22 @@ _dl_lookup_versioned_symbol (const char *undef_name,
}
}
/* We have to check whether this would bind UNDEF_MAP to an object
in the global scope which was dynamically loaded. In this case
we have to prevent the latter from being unloaded unless the
UNDEF_MAP object is also unloaded. */
if (__builtin_expect (current_value.m->l_type == lt_loaded, 0)
/* Don't do this for explicit lookups as opposed to implicit
runtime lookups. */
&& flags != 0
/* Add UNDEF_MAP to the dependencies. */
&& add_dependency (undef_map, current_value.m) < 0)
/* Something went wrong. Perhaps the object we tried to reference
was just removed. Try finding another definition. */
return INTUSE(_dl_lookup_versioned_symbol) (undef_name, undef_map,
ref, symbol_scope,
version, type_class, flags);
if (__builtin_expect (GL(dl_debug_mask)
& (DL_DEBUG_BINDINGS|DL_DEBUG_PRELINK), 0))
_dl_debug_bindings (undef_name, undef_map, ref, symbol_scope,
@ -545,8 +540,8 @@ _dl_lookup_versioned_symbol_skip (const char *undef_name,
if (__builtin_expect (protected != 0, 0))
{
/* It is very tricky. We need to figure out what value to
return for the protected symbol */
/* It is very tricky. We need to figure out what value to
return for the protected symbol. */
struct sym_val protected_value = { NULL, NULL };
if (i >= (*scope)->r_nlist

View File

@ -1,3 +1,8 @@
2002-04-14 Wolfram Gloger <wg@malloc.de>
* tests-mbwc/tst_types.h: Increase MONSIZE.
* tests-mbwc/tst_strfmon.c: Fail test if buffer too small.
2002-04-05 Jakub Jelinek <jakub@redhat.com>
* locales/ms_MY (day): Fix a typo.

View File

@ -27,6 +27,12 @@ tst_strfmon (FILE * fp, int debug_flg)
fmt = TST_INPUT (strfmon).fmt;
val = TST_INPUT (strfmon).val;
memset (buf, 0, MONSIZE);
if (nbt > MONSIZE)
{
err_count++;
Result (C_FAILURE, S_STRFMON, CASE_3, "buffer too small in test");
continue;
}
TST_CLEAR_ERRNO;
ret = strfmon (buf, nbt, fmt, val, val, val);

View File

@ -19,7 +19,7 @@
#define MBSSIZE 24
#define WCSSIZE 12
#define MONFMTSIZE 16
#define MONSIZE 32
#define MONSIZE 64
#define USE_MBCURMAX 99 /* well, but ... */
#define TST_DBL_EPS 2.22153e-16
#define WCSTOK_SEQNUM 3

View File

@ -259,8 +259,10 @@ __mktime_internal (struct tm *tp,
int sec_requested = sec;
/* Only years after 1970 are defined. */
if (year < 70)
/* Only years after 1970 are defined.
If year is 69, it might still be representable due to
timezone differences. */
if (year < 69)
return -1;
#if LEAP_SECONDS_POSSIBLE
@ -370,6 +372,14 @@ __mktime_internal (struct tm *tp,
return -1;
}
if (year == 69)
{
/* If year was 69, need to check whether the time was representable
or not. */
if (t < 0 || t > 2 * 24 * 60 * 60)
return -1;
}
*tp = tm;
return t;
}

View File

@ -5,7 +5,8 @@
int
main (void)
{
struct tm time_str;
struct tm time_str, *tm;
time_t t;
char daybuf[20];
int result;
@ -29,5 +30,38 @@ main (void)
result = strcmp (daybuf, "Wednesday") != 0;
}
setenv ("TZ", "EST", 1);
#define EVENING69 1 * 60 * 60 + 2 * 60 + 29
t = EVENING69;
tm = localtime (&t);
if (tm == NULL)
{
(void) puts ("localtime returned NULL");
result = 1;
}
else
{
time_str = *tm;
t = mktime (&time_str);
if (t != EVENING69)
{
printf ("mktime returned %ld, expected %ld\n",
(long) t, EVENING69);
result = 1;
}
else
(void) puts ("Dec 31 1969 EST test passed");
setenv ("TZ", "CET", 1);
t = mktime (&time_str);
if (t != (time_t) -1)
{
printf ("mktime returned %ld, expected -1\n", (long) t);
result = 1;
}
else
(void) puts ("Dec 31 1969 CET test passed");
}
return result;
}