1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00
1998-09-09 09:32  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/powerpc/dl-machine.h (elf_machine_rela): Make function
	inline.

1998-09-07  Paul Eggert  <eggert@twinsun.com>

	* time/mktime.c (__EXTENSIONS__): Define if not defined.
	(_REENTRANT): Remove.  It has undesirable consequences in
	Solaris 2.6 (e.g. it turns off the putc macro).  Defining
	__EXTENSIONS__ makes localtime_r and gmtime_r visible, which
	is what we want.
	* time/strftime.c: Likewise.

1998-09-08  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* elf/dl-error.c: Fix spelling.

1998-09-08  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* stdlib/strfmon.c: Quiet -Wparentheses warnings.
	* stdio-common/_itoa.c: Likewise.
	* stdio-common/printf_fp.c: Likewise.
	* stdio-common/vfscanf.c: Likewise.
	* wcsmbs/wcstok.c: Likewise.
	* sysdeps/generic/glob.c: Likewise.
	* posix/getopt.c: Likewise.
	* sysdeps/posix/getaddrinfo.c: Likewise.
	* posix/wordexp.c: Likewise.
	* io/ftw.c: Likewise.
	* io/fts.c: Likewise.
	* misc/getpass.c: Likewise.
	* iconv/gconv_conf.c: Likewise.
	* argp/argp-fmtstream.c: Likewise.
	* argp/argp-help.c: Likewise.
	* elf/dl-load.c: Likewise.
	* locale/programs/stringtrans.c: Likewise.
	* catgets/gencat.c: Likewise.
	* posix/getconf.c: Likewise.
	* iconv/gconv_conf.c: Likewise.
	* iconv/iconv_prog.c: Likewise.

	* string/strcoll.c: Optimize a few expressions.
	* string/strxfrm.c: Likewise.

1998-09-08  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* elf/dl-open.c (dl_open_worker): Move decl of new_global up one
	level to avoid uninit variable warning.

1998-09-09 10:34  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
	instead of _dl_default_scope[2] as argument to _dl_init_next.
	Fix compatibility problems introduced in last change.
This commit is contained in:
Ulrich Drepper
1998-09-09 11:53:19 +00:00
parent 7fd18ea2de
commit 6e4c40baac
28 changed files with 461 additions and 355 deletions

View File

@ -1,13 +1,64 @@
Wed Sep 9 10:34:06 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> 1998-09-09 09:32 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/powerpc/dl-machine.h (elf_machine_rela): Make function
inline.
1998-09-07 Paul Eggert <eggert@twinsun.com>
* time/mktime.c (__EXTENSIONS__): Define if not defined.
(_REENTRANT): Remove. It has undesirable consequences in
Solaris 2.6 (e.g. it turns off the putc macro). Defining
__EXTENSIONS__ makes localtime_r and gmtime_r visible, which
is what we want.
* time/strftime.c: Likewise.
1998-09-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* elf/dl-error.c: Fix spelling.
1998-09-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* stdlib/strfmon.c: Quiet -Wparentheses warnings.
* stdio-common/_itoa.c: Likewise.
* stdio-common/printf_fp.c: Likewise.
* stdio-common/vfscanf.c: Likewise.
* wcsmbs/wcstok.c: Likewise.
* sysdeps/generic/glob.c: Likewise.
* posix/getopt.c: Likewise.
* sysdeps/posix/getaddrinfo.c: Likewise.
* posix/wordexp.c: Likewise.
* io/ftw.c: Likewise.
* io/fts.c: Likewise.
* misc/getpass.c: Likewise.
* iconv/gconv_conf.c: Likewise.
* argp/argp-fmtstream.c: Likewise.
* argp/argp-help.c: Likewise.
* elf/dl-load.c: Likewise.
* locale/programs/stringtrans.c: Likewise.
* catgets/gencat.c: Likewise.
* posix/getconf.c: Likewise.
* iconv/gconv_conf.c: Likewise.
* iconv/iconv_prog.c: Likewise.
* string/strcoll.c: Optimize a few expressions.
* string/strxfrm.c: Likewise.
1998-09-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* elf/dl-open.c (dl_open_worker): Move decl of new_global up one
level to avoid uninit variable warning.
1998-09-09 10:34 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/m68k/dl-machine.h(RTLD_START): Push _dl_main_searchlist * sysdeps/m68k/dl-machine.h(RTLD_START): Push _dl_main_searchlist
instead of _dl_default_scope[2] as argument to _dl_init_next. instead of _dl_default_scope[2] as argument to _dl_init_next.
* sysdeps/m68k/fpu/bits/mathinline.h (isinf): Avoid conflict with * sysdeps/m68k/fpu/bits/mathinline.h (isinf): Avoid conflict with
C9x macro. C9x macro.
1998-09-08 Ulrich Drepper <drepper@cygnus.com> 1998-09-08 Ulrich Drepper <drepper@cygnus.com>
Fix compatibility problems introduced in last change.
* csu/initfini.c: Don't define __gmon_start__ if WEAK_GMON_START is * csu/initfini.c: Don't define __gmon_start__ if WEAK_GMON_START is
defined. defined.
* sysdeps/unix/sysv/linux/i386/Makefile [subdir==csu]: Add * sysdeps/unix/sysv/linux/i386/Makefile [subdir==csu]: Add

View File

@ -253,25 +253,27 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
if (nextline == buf + len + 1 if (nextline == buf + len + 1
? fs->end - nl < fs->wmargin + 1 ? fs->end - nl < fs->wmargin + 1
: nextline - (nl + 1) < fs->wmargin) : nextline - (nl + 1) < fs->wmargin)
/* The margin needs more blanks than we removed. */ {
if (fs->end - fs->p > fs->wmargin + 1) /* The margin needs more blanks than we removed. */
/* Make some space for them. */ if (fs->end - fs->p > fs->wmargin + 1)
{ /* Make some space for them. */
size_t mv = fs->p - nextline; {
memmove (nl + 1 + fs->wmargin, nextline, mv); size_t mv = fs->p - nextline;
nextline = nl + 1 + fs->wmargin; memmove (nl + 1 + fs->wmargin, nextline, mv);
len = nextline + mv - buf; nextline = nl + 1 + fs->wmargin;
*nl++ = '\n'; len = nextline + mv - buf;
} *nl++ = '\n';
else }
/* Output the first line so we can use the space. */ else
{ /* Output the first line so we can use the space. */
if (nl > fs->buf) {
fwrite_unlocked (fs->buf, 1, nl - fs->buf, fs->stream); if (nl > fs->buf)
putc_unlocked ('\n', fs->stream); fwrite_unlocked (fs->buf, 1, nl - fs->buf, fs->stream);
len += buf - fs->buf; putc_unlocked ('\n', fs->stream);
nl = buf = fs->buf; len += buf - fs->buf;
} nl = buf = fs->buf;
}
}
else else
/* We can fit the newline and blanks in before /* We can fit the newline and blanks in before
the next word. */ the next word. */

View File

@ -183,14 +183,16 @@ fill_in_uparams (const struct argp_state *state)
} }
if (unspec) if (unspec)
if (var[0] == 'n' && var[1] == 'o' && var[2] == '-') {
{ if (var[0] == 'n' && var[1] == 'o' && var[2] == '-')
val = 0; {
var += 3; val = 0;
var_len -= 3; var += 3;
} var_len -= 3;
else }
val = 1; else
val = 1;
}
else if (isdigit (*arg)) else if (isdigit (*arg))
{ {
val = atoi (arg); val = atoi (arg);
@ -709,20 +711,22 @@ hol_entry_cmp (const struct hol_entry *entry1,
int group1 = entry1->group, group2 = entry2->group; int group1 = entry1->group, group2 = entry2->group;
if (entry1->cluster != entry2->cluster) if (entry1->cluster != entry2->cluster)
/* The entries are not within the same cluster, so we can't compare them {
directly, we have to use the appropiate clustering level too. */ /* The entries are not within the same cluster, so we can't compare them
if (! entry1->cluster) directly, we have to use the appropiate clustering level too. */
/* ENTRY1 is at the `base level', not in a cluster, so we have to if (! entry1->cluster)
compare it's group number with that of the base cluster in which /* ENTRY1 is at the `base level', not in a cluster, so we have to
ENTRY2 resides. Note that if they're in the same group, the compare it's group number with that of the base cluster in which
clustered option always comes laster. */ ENTRY2 resides. Note that if they're in the same group, the
return group_cmp (group1, hol_cluster_base (entry2->cluster)->group, -1); clustered option always comes laster. */
else if (! entry2->cluster) return group_cmp (group1, hol_cluster_base (entry2->cluster)->group, -1);
/* Likewise, but ENTRY2's not in a cluster. */ else if (! entry2->cluster)
return group_cmp (hol_cluster_base (entry1->cluster)->group, group2, 1); /* Likewise, but ENTRY2's not in a cluster. */
else return group_cmp (hol_cluster_base (entry1->cluster)->group, group2, 1);
/* Both entries are in clusters, we can just compare the clusters. */ else
return hol_cluster_cmp (entry1->cluster, entry2->cluster); /* Both entries are in clusters, we can just compare the clusters. */
return hol_cluster_cmp (entry1->cluster, entry2->cluster);
}
else if (group1 == group2) else if (group1 == group2)
/* The entries are both in the same cluster and group, so compare them /* The entries are both in the same cluster and group, so compare them
alphabetically. */ alphabetically. */
@ -1115,13 +1119,15 @@ hol_entry_help (struct hol_entry *entry, const struct argp_state *state,
__argp_fmtstream_set_lmargin (stream, 0); __argp_fmtstream_set_lmargin (stream, 0);
if (pest.first) if (pest.first)
/* Didn't print any switches, what's up? */ {
if (!oshort (real) && !real->name) /* Didn't print any switches, what's up? */
/* This is a group header, print it nicely. */ if (!oshort (real) && !real->name)
print_header (real->doc, entry->argp, &pest); /* This is a group header, print it nicely. */
else print_header (real->doc, entry->argp, &pest);
/* Just a totally shadowed option or null header; print nothing. */ else
goto cleanup; /* Just return, after cleaning up. */ /* Just a totally shadowed option or null header; print nothing. */
goto cleanup; /* Just return, after cleaning up. */
}
else else
{ {
const char *tstr = real->doc ? dgettext (state->root_argp->argp_domain, const char *tstr = real->doc ? dgettext (state->root_argp->argp_domain,

View File

@ -838,16 +838,18 @@ write_out (struct catalog *catalog, const char *output_name,
#define out. But we have to take care for the set #define out. But we have to take care for the set
not having a symbolic name. */ not having a symbolic name. */
if (message_run->symbol != NULL) if (message_run->symbol != NULL)
if (set_run->symbol == NULL) {
fprintf (fp, "#define AutomaticSet%d%s %#x\t/* %s:%Zu */\n", if (set_run->symbol == NULL)
set_run->number, message_run->symbol, fprintf (fp, "#define AutomaticSet%d%s %#x\t/* %s:%Zu */\n",
message_run->number, message_run->fname, set_run->number, message_run->symbol,
message_run->line); message_run->number, message_run->fname,
else message_run->line);
fprintf (fp, "#define %s%s %#x\t/* %s:%Zu */\n", else
set_run->symbol, message_run->symbol, fprintf (fp, "#define %s%s %#x\t/* %s:%Zu */\n",
message_run->number, message_run->fname, set_run->symbol, message_run->symbol,
message_run->line); message_run->number, message_run->fname,
message_run->line);
}
message_run = message_run->next; message_run = message_run->next;
} }
@ -995,11 +997,13 @@ read_old (struct catalog *catalog, const char *file_name)
__open_catalog (&old_cat_obj); __open_catalog (&old_cat_obj);
if (old_cat_obj.status != mmapped && old_cat_obj.status != malloced) if (old_cat_obj.status != mmapped && old_cat_obj.status != malloced)
if (errno == ENOENT) {
/* No problem, the catalog simply does not exist. */ if (errno == ENOENT)
return; /* No problem, the catalog simply does not exist. */
else return;
error (EXIT_FAILURE, errno, gettext ("while opening old catalog file")); else
error (EXIT_FAILURE, errno, gettext ("while opening old catalog file"));
}
/* OK, we have the catalog loaded. Now read all messages and merge /* OK, we have the catalog loaded. Now read all messages and merge
them. When set and message number clash for any message the new them. When set and message number clash for any message the new

View File

@ -33,15 +33,15 @@ struct catch
}; };
/* Multiple threads at once can use the `_dl_catch_error' function. The /* Multiple threads at once can use the `_dl_catch_error' function. The
calls can come from the `_dl_map_object_deps', `_dlerror_run', or from calls can come from `_dl_map_object_deps', `_dlerror_run', or from
any of the libc functionality which loads dynamic objects (NSS, iconv). any of the libc functionality which loads dynamic objects (NSS, iconv).
Therefore we have to be prepared to safe the state in thread-local Therefore we have to be prepared to save the state in thread-local
memory. `catch' will only be used for the non-threaded case. memory. `catch' will only be used for the non-threaded case.
Please note the horrible kludge we have to use to check for the Please note the horrible kludge we have to use to check for the
thread functions to be defined. The problem is that while running thread functions to be defined. The problem is that while running
ld.so standalone (i.e., before the relocation with the libc symbols ld.so standalone (i.e., before the relocation with the available
available) we do not have a real handling of undefined weak symbols. libc symbols) we do not have a real handling of undefined weak symbols.
All symbols are relocated, regardless of the availability. They are All symbols are relocated, regardless of the availability. They are
relocated relative to the load address of the dynamic linker. Adding relocated relative to the load address of the dynamic linker. Adding
this start address to zero (the value in the GOT for undefined symbols) this start address to zero (the value in the GOT for undefined symbols)

View File

@ -1100,23 +1100,25 @@ open_path (const char *name, size_t namelen, int preloaded,
fd = __open (buf, O_RDONLY); fd = __open (buf, O_RDONLY);
if (this_dir->status[cnt] == unknown) if (this_dir->status[cnt] == unknown)
if (fd != -1) {
this_dir->status[cnt] = existing; if (fd != -1)
else this_dir->status[cnt] = existing;
{ else
/* We failed to open machine dependent library. Let's {
test whether there is any directory at all. */ /* We failed to open machine dependent library. Let's
struct stat st; test whether there is any directory at all. */
struct stat st;
buf[buflen - namelen - 1] = '\0'; buf[buflen - namelen - 1] = '\0';
if (__xstat (_STAT_VER, buf, &st) != 0 if (__xstat (_STAT_VER, buf, &st) != 0
|| ! S_ISDIR (st.st_mode)) || ! S_ISDIR (st.st_mode))
/* The directory does not exist or it is no directory. */ /* The directory does not exist or it is no directory. */
this_dir->status[cnt] = nonexisting; this_dir->status[cnt] = nonexisting;
else else
this_dir->status[cnt] = existing; this_dir->status[cnt] = existing;
} }
}
if (fd != -1 && preloaded && __libc_enable_secure) if (fd != -1 && preloaded && __libc_enable_secure)
{ {

View File

@ -127,6 +127,8 @@ dl_open_worker (void *a)
new->l_global = (mode & RTLD_GLOBAL) ? 1 : 0; new->l_global = (mode & RTLD_GLOBAL) ? 1 : 0;
if (new->l_global) if (new->l_global)
{ {
struct link_map **new_global;
/* The symbols of the new object and its dependencies are to be /* The symbols of the new object and its dependencies are to be
introduced into the global scope that will be used to resolve introduced into the global scope that will be used to resolve
references from other dynamically-loaded objects. references from other dynamically-loaded objects.
@ -143,8 +145,6 @@ dl_open_worker (void *a)
if (_dl_global_scope_alloc == 0) if (_dl_global_scope_alloc == 0)
{ {
/* This is the first dynamic object given global scope. */ /* This is the first dynamic object given global scope. */
struct link_map **new_global;
_dl_global_scope_alloc = _dl_main_searchlist->r_nlist + 8; _dl_global_scope_alloc = _dl_main_searchlist->r_nlist + 8;
new_global = (struct link_map **) new_global = (struct link_map **)
malloc (_dl_global_scope_alloc * sizeof (struct link_map *)); malloc (_dl_global_scope_alloc * sizeof (struct link_map *));
@ -166,8 +166,6 @@ dl_open_worker (void *a)
{ {
/* We have to extend the existing array of link maps in the /* We have to extend the existing array of link maps in the
main map. */ main map. */
struct link_map **new_global;
new_global = (struct link_map **) new_global = (struct link_map **)
malloc ((_dl_global_scope_alloc + 8) * sizeof (struct link_map *)); malloc ((_dl_global_scope_alloc + 8) * sizeof (struct link_map *));
if (new_global == NULL) if (new_global == NULL)

View File

@ -291,11 +291,13 @@ add_module (char *rp, const char *directory, size_t dir_len, void **modules,
memcpy (tmp - 1, gconv_module_ext, sizeof (gconv_module_ext)); memcpy (tmp - 1, gconv_module_ext, sizeof (gconv_module_ext));
if (__tfind (new_module, modules, module_compare) == NULL) if (__tfind (new_module, modules, module_compare) == NULL)
if (__tsearch (new_module, modules, module_compare) == NULL) {
/* Something went wrong while inserting the new module. */ if (__tsearch (new_module, modules, module_compare) == NULL)
free (new_module); /* Something went wrong while inserting the new module. */
else free (new_module);
++*nmodules; else
++*nmodules;
}
} }
} }

View File

@ -139,11 +139,13 @@ main (int argc, char *argv[])
/* Let's see whether we have these coded character sets. */ /* Let's see whether we have these coded character sets. */
cd = iconv_open (to_code, from_code); cd = iconv_open (to_code, from_code);
if (cd == (iconv_t) -1) if (cd == (iconv_t) -1)
if (errno == EINVAL) {
error (EXIT_FAILURE, 0, _("conversion from `%s' to `%s' not supported"), if (errno == EINVAL)
from_code, to_code); error (EXIT_FAILURE, 0, _("conversion from `%s' to `%s' not supported"),
else from_code, to_code);
error (EXIT_FAILURE, errno, _("failed to start conversion processing")); else
error (EXIT_FAILURE, errno, _("failed to start conversion processing"));
}
/* Determine output file. */ /* Determine output file. */
if (output_file != NULL) if (output_file != NULL)

View File

@ -313,12 +313,13 @@ fts_read(sp)
if (instr == FTS_FOLLOW && if (instr == FTS_FOLLOW &&
(p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) { (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) {
p->fts_info = fts_stat(sp, NULL, p, 1); p->fts_info = fts_stat(sp, NULL, p, 1);
if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
if ((p->fts_symfd = __open(".", O_RDONLY, 0)) < 0) { if ((p->fts_symfd = __open(".", O_RDONLY, 0)) < 0) {
p->fts_errno = errno; p->fts_errno = errno;
p->fts_info = FTS_ERR; p->fts_info = FTS_ERR;
} else } else
p->fts_flags |= FTS_SYMFOLLOW; p->fts_flags |= FTS_SYMFOLLOW;
}
return (p); return (p);
} }
@ -401,13 +402,14 @@ next: tmp = p;
goto next; goto next;
if (p->fts_instr == FTS_FOLLOW) { if (p->fts_instr == FTS_FOLLOW) {
p->fts_info = fts_stat(sp, NULL, p, 1); p->fts_info = fts_stat(sp, NULL, p, 1);
if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
if ((p->fts_symfd = if ((p->fts_symfd =
__open(".", O_RDONLY, 0)) < 0) { __open(".", O_RDONLY, 0)) < 0) {
p->fts_errno = errno; p->fts_errno = errno;
p->fts_info = FTS_ERR; p->fts_info = FTS_ERR;
} else } else
p->fts_flags |= FTS_SYMFOLLOW; p->fts_flags |= FTS_SYMFOLLOW;
}
p->fts_instr = FTS_NOINSTR; p->fts_instr = FTS_NOINSTR;
} }
@ -641,7 +643,7 @@ fts_build(sp, type)
* checking FTS_NS on the returned nodes. * checking FTS_NS on the returned nodes.
*/ */
cderrno = 0; cderrno = 0;
if (nlinks || type == BREAD) if (nlinks || type == BREAD) {
if (FCHDIR(sp, dirfd(dirp))) { if (FCHDIR(sp, dirfd(dirp))) {
if (nlinks && type == BREAD) if (nlinks && type == BREAD)
cur->fts_errno = errno; cur->fts_errno = errno;
@ -650,7 +652,7 @@ fts_build(sp, type)
cderrno = errno; cderrno = errno;
} else } else
descend = 1; descend = 1;
else } else
descend = 0; descend = 0;
/* /*

View File

@ -547,46 +547,48 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors,
/* Get stat info for start directory. */ /* Get stat info for start directory. */
if (result == 0) if (result == 0)
if (((flags & FTW_PHYS) {
? LXSTAT (_STAT_VER, data.dirbuf, &st) if (((flags & FTW_PHYS)
: XSTAT (_STAT_VER, data.dirbuf, &st)) < 0) ? LXSTAT (_STAT_VER, data.dirbuf, &st)
{ : XSTAT (_STAT_VER, data.dirbuf, &st)) < 0)
if (errno == EACCES) {
result = (*data.func) (data.dirbuf, &st, FTW_NS, &data.ftw); if (errno == EACCES)
else if (!(flags & FTW_PHYS) result = (*data.func) (data.dirbuf, &st, FTW_NS, &data.ftw);
&& errno == ENOENT else if (!(flags & FTW_PHYS)
&& LXSTAT (_STAT_VER, dir, &st) == 0 && errno == ENOENT
&& S_ISLNK (st.st_mode)) && LXSTAT (_STAT_VER, dir, &st) == 0
result = (*data.func) (data.dirbuf, &st, data.cvt_arr[FTW_SLN], && S_ISLNK (st.st_mode))
&data.ftw); result = (*data.func) (data.dirbuf, &st, data.cvt_arr[FTW_SLN],
else
/* No need to call the callback since we cannot say anything
about the object. */
result = -1;
}
else
{
if (S_ISDIR (st.st_mode))
{
/* Remember the device of the initial directory in case
FTW_MOUNT is given. */
data.dev = st.st_dev;
/* We know this directory now. */
if (!(flags & FTW_PHYS))
result = add_object (&data, &st);
if (result == 0)
result = ftw_dir (&data, &st);
}
else
{
int flag = S_ISLNK (st.st_mode) ? FTW_SL : FTW_F;
result = (*data.func) (data.dirbuf, &st, data.cvt_arr[flag],
&data.ftw); &data.ftw);
} else
} /* No need to call the callback since we cannot say anything
about the object. */
result = -1;
}
else
{
if (S_ISDIR (st.st_mode))
{
/* Remember the device of the initial directory in case
FTW_MOUNT is given. */
data.dev = st.st_dev;
/* We know this directory now. */
if (!(flags & FTW_PHYS))
result = add_object (&data, &st);
if (result == 0)
result = ftw_dir (&data, &st);
}
else
{
int flag = S_ISLNK (st.st_mode) ? FTW_SL : FTW_F;
result = (*data.func) (data.dirbuf, &st, data.cvt_arr[flag],
&data.ftw);
}
}
}
/* Return to the start directory (if necessary). */ /* Return to the start directory (if necessary). */
if (cwd != NULL) if (cwd != NULL)

View File

@ -78,11 +78,8 @@ translate_string (char *str, struct charset_t *charset)
tp = &str[1]; tp = &str[1];
while (tp[0] != '\0' && tp[0] != '>') while (tp[0] != '\0' && tp[0] != '>')
if (tp[0] == '\\') if (tp[0] == '\\' && tp[1] != '\0')
if (tp[1] != '\0') tp += 2;
tp += 2;
else
++tp;
else else
++tp; ++tp;

View File

@ -79,16 +79,18 @@ getpass (prompt)
/* Read the password. */ /* Read the password. */
nread = __getline (&buf, &bufsize, in); nread = __getline (&buf, &bufsize, in);
if (buf != NULL) if (buf != NULL)
if (nread < 0) {
buf[0] = '\0'; if (nread < 0)
else if (buf[nread - 1] == '\n') buf[0] = '\0';
{ else if (buf[nread - 1] == '\n')
/* Remove the newline. */ {
buf[nread - 1] = '\0'; /* Remove the newline. */
if (tty_changed) buf[nread - 1] = '\0';
/* Write the newline that was not echoed. */ if (tty_changed)
putc_unlocked ('\n', out); /* Write the newline that was not echoed. */
} putc_unlocked ('\n', out);
}
}
/* Restore the original setting. */ /* Restore the original setting. */
if (tty_changed) if (tty_changed)

View File

@ -662,11 +662,13 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
usage (); usage ();
value = sysconf (c->call_name); value = sysconf (c->call_name);
if (value == -1l) if (value == -1l)
if (c->call_name == _SC_UINT_MAX {
|| c->call_name == _SC_ULONG_MAX) if (c->call_name == _SC_UINT_MAX
printf ("%lu\n", value); || c->call_name == _SC_ULONG_MAX)
else printf ("%lu\n", value);
puts (_("undefined")); else
puts (_("undefined"));
}
else else
printf ("%ld\n", value); printf ("%ld\n", value);
exit (0); exit (0);

View File

@ -695,16 +695,18 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
else else
{ {
if (opterr) if (opterr)
if (argv[optind - 1][1] == '-') {
/* --option */ if (argv[optind - 1][1] == '-')
fprintf (stderr, /* --option */
_("%s: option `--%s' doesn't allow an argument\n"), fprintf (stderr,
argv[0], pfound->name); _("%s: option `--%s' doesn't allow an argument\n"),
else argv[0], pfound->name);
/* +option or -option */ else
fprintf (stderr, /* +option or -option */
_("%s: option `%c%s' doesn't allow an argument\n"), fprintf (stderr,
argv[0], argv[optind - 1][0], pfound->name); _("%s: option `%c%s' doesn't allow an argument\n"),
argv[0], argv[optind - 1][0], pfound->name);
}
nextchar += strlen (nextchar); nextchar += strlen (nextchar);

View File

@ -426,6 +426,7 @@ parse_glob (char **word, size_t *word_length, size_t *max_length,
/* Sort out quoting */ /* Sort out quoting */
if (words[*offset] == '\'') if (words[*offset] == '\'')
{
if (quoted == 0) if (quoted == 0)
{ {
quoted = 1; quoted = 1;
@ -436,17 +437,20 @@ parse_glob (char **word, size_t *word_length, size_t *max_length,
quoted = 0; quoted = 0;
continue; continue;
} }
}
else if (words[*offset] == '"') else if (words[*offset] == '"')
if (quoted == 0) {
{ if (quoted == 0)
quoted = 2; {
continue; quoted = 2;
} continue;
else if (quoted == 2) }
{ else if (quoted == 2)
quoted = 0; {
continue; quoted = 0;
} continue;
}
}
/* Sort out other special characters */ /* Sort out other special characters */
if (quoted != 1 && words[*offset] == '$') if (quoted != 1 && words[*offset] == '$')

View File

@ -182,29 +182,32 @@ _itoa (value, buflim, base, upper_case)
mp_limb_t work_hi = value >> (64 - BITS_PER_MP_LIMB); \ mp_limb_t work_hi = value >> (64 - BITS_PER_MP_LIMB); \
\ \
if (BITS_PER_MP_LIMB == 32) \ if (BITS_PER_MP_LIMB == 32) \
if (work_hi != 0) \ { \
{ \ if (work_hi != 0) \
mp_limb_t work_lo; \ { \
int cnt; \ mp_limb_t work_lo; \
int cnt; \
\ \
work_lo = value & 0xfffffffful; \ work_lo = value & 0xfffffffful; \
for (cnt = BITS_PER_MP_LIMB / BITS; cnt > 0; --cnt) \ for (cnt = BITS_PER_MP_LIMB / BITS; cnt > 0; --cnt) \
{ \ { \
*--bp = digits[work_lo & ((1ul << BITS) - 1)]; \ *--bp = digits[work_lo & ((1ul << BITS) - 1)]; \
work_lo >>= BITS; \ work_lo >>= BITS; \
} \ } \
if (BITS_PER_MP_LIMB % BITS != 0) \ if (BITS_PER_MP_LIMB % BITS != 0) \
{ \ { \
work_lo |= ((work_hi \ work_lo \
& ((1 << (BITS - BITS_PER_MP_LIMB%BITS)) \ |= ((work_hi \
- 1)) \ & ((1 << (BITS - BITS_PER_MP_LIMB%BITS)) \
<< BITS_PER_MP_LIMB % BITS); \ - 1)) \
*--bp = digits[work_lo]; \ << BITS_PER_MP_LIMB % BITS); \
work_hi >>= BITS - BITS_PER_MP_LIMB % BITS; \ *--bp = digits[work_lo]; \
} \ work_hi >>= BITS - BITS_PER_MP_LIMB % BITS; \
} \ } \
else \ } \
work_hi = value & 0xfffffffful; \ else \
work_hi = value & 0xfffffffful; \
} \
do \ do \
{ \ { \
*--bp = digits[work_hi & ((1 << BITS) - 1)]; \ *--bp = digits[work_hi & ((1 << BITS) - 1)]; \

View File

@ -574,19 +574,21 @@ __printf_fp (FILE *fp,
for overflow. This is done by comparing with 10 shifted for overflow. This is done by comparing with 10 shifted
to the right position. */ to the right position. */
if (incr == exponent + 3) if (incr == exponent + 3)
if (cnt_h <= BITS_PER_MP_LIMB - 4) {
{ if (cnt_h <= BITS_PER_MP_LIMB - 4)
topval[0] = 0; {
topval[1] topval[0] = 0;
= ((mp_limb_t) 10) << (BITS_PER_MP_LIMB - 4 - cnt_h); topval[1]
} = ((mp_limb_t) 10) << (BITS_PER_MP_LIMB - 4 - cnt_h);
else }
{ else
topval[0] = ((mp_limb_t) 10) << (BITS_PER_MP_LIMB - 4); {
topval[1] = 0; topval[0] = ((mp_limb_t) 10) << (BITS_PER_MP_LIMB - 4);
(void) __mpn_lshift (topval, topval, 2, topval[1] = 0;
BITS_PER_MP_LIMB - cnt_h); (void) __mpn_lshift (topval, topval, 2,
} BITS_PER_MP_LIMB - cnt_h);
}
}
/* We have to be careful when multiplying the last factor. /* We have to be careful when multiplying the last factor.
If the result is greater than 1.0 be have to test it If the result is greater than 1.0 be have to test it
@ -816,23 +818,25 @@ __printf_fp (FILE *fp,
char *tp = cp; char *tp = cp;
if (digit == '5' && (*(cp - 1) & 1) == 0) if (digit == '5' && (*(cp - 1) & 1) == 0)
/* This is the critical case. */ {
if (fracsize == 1 && frac[0] == 0) /* This is the critical case. */
/* Rest of the number is zero -> round to even. if (fracsize == 1 && frac[0] == 0)
(IEEE 754-1985 4.1 says this is the default rounding.) */ /* Rest of the number is zero -> round to even.
goto do_expo; (IEEE 754-1985 4.1 says this is the default rounding.) */
else if (scalesize == 0) goto do_expo;
{ else if (scalesize == 0)
/* Here we have to see whether all limbs are zero since no {
normalization happened. */ /* Here we have to see whether all limbs are zero since no
size_t lcnt = fracsize; normalization happened. */
while (lcnt >= 1 && frac[lcnt - 1] == 0) size_t lcnt = fracsize;
--lcnt; while (lcnt >= 1 && frac[lcnt - 1] == 0)
if (lcnt == 0) --lcnt;
/* Rest of the number is zero -> round to even. if (lcnt == 0)
(IEEE 754-1985 4.1 says this is the default rounding.) */ /* Rest of the number is zero -> round to even.
goto do_expo; (IEEE 754-1985 4.1 says this is the default rounding.) */
} goto do_expo;
}
}
if (fracdig_no > 0) if (fracdig_no > 0)
{ {

View File

@ -602,11 +602,13 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
#define NEXT_WIDE_CHAR(First) \ #define NEXT_WIDE_CHAR(First) \
c = inchar (); \ c = inchar (); \
if (c == EOF) \ if (c == EOF) \
/* EOF is only an error for the first character. */ \ { \
if (First) \ /* EOF is only an error for the first character. */ \
input_error (); \ if (First) \
else \ input_error (); \
break; \ else \
break; \
} \
val = c; \ val = c; \
if (val >= 0x80) \ if (val >= 0x80) \
{ \ { \

View File

@ -296,18 +296,22 @@ __strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...)
case 'i': /* Use international currency symbol. */ case 'i': /* Use international currency symbol. */
currency_symbol = _NL_CURRENT (LC_MONETARY, INT_CURR_SYMBOL); currency_symbol = _NL_CURRENT (LC_MONETARY, INT_CURR_SYMBOL);
if (right_prec == -1) if (right_prec == -1)
if (*_NL_CURRENT (LC_MONETARY, INT_FRAC_DIGITS) == CHAR_MAX) {
right_prec = 2; if (*_NL_CURRENT (LC_MONETARY, INT_FRAC_DIGITS) == CHAR_MAX)
else right_prec = 2;
right_prec = *_NL_CURRENT (LC_MONETARY, INT_FRAC_DIGITS); else
right_prec = *_NL_CURRENT (LC_MONETARY, INT_FRAC_DIGITS);
}
break; break;
case 'n': /* Use national currency symbol. */ case 'n': /* Use national currency symbol. */
currency_symbol = _NL_CURRENT (LC_MONETARY, CURRENCY_SYMBOL); currency_symbol = _NL_CURRENT (LC_MONETARY, CURRENCY_SYMBOL);
if (right_prec == -1) if (right_prec == -1)
if (*_NL_CURRENT (LC_MONETARY, FRAC_DIGITS) == CHAR_MAX) {
right_prec = 2; if (*_NL_CURRENT (LC_MONETARY, FRAC_DIGITS) == CHAR_MAX)
else right_prec = 2;
right_prec = *_NL_CURRENT (LC_MONETARY, FRAC_DIGITS); else
right_prec = *_NL_CURRENT (LC_MONETARY, FRAC_DIGITS);
}
break; break;
default: /* Any unrecognized format is an error. */ default: /* Any unrecognized format is an error. */
__set_errno (EINVAL); __set_errno (EINVAL);
@ -493,24 +497,26 @@ __strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...)
/* Now test whether the output width is filled. */ /* Now test whether the output width is filled. */
if (dest - startp < width) if (dest - startp < width)
if (left) {
/* We simply have to fill using spaces. */ if (left)
do /* We simply have to fill using spaces. */
out_char (' ');
while (dest - startp < width);
else
{
int dist = width - (dest - startp);
char *cp;
for (cp = dest - 1; cp >= startp; --cp)
cp[dist] = cp[0];
dest += dist;
do do
startp[--dist] = ' '; out_char (' ');
while (dist > 0); while (dest - startp < width);
} else
{
int dist = width - (dest - startp);
char *cp;
for (cp = dest - 1; cp >= startp; --cp)
cp[dist] = cp[0];
dest += dist;
do
startp[--dist] = ' ';
while (dist > 0);
}
}
} }
/* Terminate the string. */ /* Terminate the string. */

View File

@ -117,8 +117,9 @@ STRCOLL (s1, s2, l)
== (uint32_t) IGNORE_CHAR)) == (uint32_t) IGNORE_CHAR))
{ {
++s1ignore; ++s1ignore;
if ((forward && ++s1idx >= s1run->data[pass].number) if (forward
|| (!forward && --s1idx < 0)) ? ++s1idx >= s1run->data[pass].number
: --s1idx < 0)
{ {
weight_t *nextp = forward ? s1run->next : s1run->prev; weight_t *nextp = forward ? s1run->next : s1run->prev;
if (nextp == NULL) if (nextp == NULL)
@ -139,8 +140,9 @@ STRCOLL (s1, s2, l)
== (uint32_t) IGNORE_CHAR)) == (uint32_t) IGNORE_CHAR))
{ {
++s2ignore; ++s2ignore;
if ((forward && ++s2idx >= s2run->data[pass].number) if (forward
|| (!forward && --s2idx < 0)) ? ++s2idx >= s2run->data[pass].number
: --s2idx < 0)
{ {
weight_t *nextp = forward ? s2run->next : s2run->prev; weight_t *nextp = forward ? s2run->next : s2run->prev;
if (nextp == NULL) if (nextp == NULL)

View File

@ -217,8 +217,9 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
== (u_int32_t) IGNORE_CHAR)) == (u_int32_t) IGNORE_CHAR))
{ {
++ignore; ++ignore;
if ((forward && ++idx >= run->data[pass].number) if (forward
|| (!forward && --idx < 0)) ? ++idx >= run->data[pass].number
: --idx < 0)
{ {
weight_t *nextp = forward ? run->next : run->prev; weight_t *nextp = forward ? run->next : run->prev;
if (nextp == NULL) if (nextp == NULL)

View File

@ -659,10 +659,12 @@ glob (pattern, flags, errfunc, pglob)
} }
} }
if (home_dir == NULL || home_dir[0] == '\0') if (home_dir == NULL || home_dir[0] == '\0')
if (flags & GLOB_TILDE_CHECK) {
return GLOB_NOMATCH; if (flags & GLOB_TILDE_CHECK)
else return GLOB_NOMATCH;
home_dir = "~"; /* No luck. */ else
home_dir = "~"; /* No luck. */
}
# endif /* WINDOWS32 */ # endif /* WINDOWS32 */
# endif # endif
/* Now construct the full directory. */ /* Now construct the full directory. */
@ -882,78 +884,80 @@ glob (pattern, flags, errfunc, pglob)
flag was set we must return the list consisting of the disrectory flag was set we must return the list consisting of the disrectory
names followed by the filename. */ names followed by the filename. */
if (pglob->gl_pathc == oldcount) if (pglob->gl_pathc == oldcount)
/* No matches. */ {
if (flags & GLOB_NOCHECK) /* No matches. */
{ if (flags & GLOB_NOCHECK)
size_t filename_len = strlen (filename) + 1; {
char **new_pathv; size_t filename_len = strlen (filename) + 1;
struct stat st; char **new_pathv;
struct stat st;
/* This is an pessimistic guess about the size. */ /* This is an pessimistic guess about the size. */
pglob->gl_pathv pglob->gl_pathv
= (char **) realloc (pglob->gl_pathv, = (char **) realloc (pglob->gl_pathv,
(pglob->gl_pathc + (pglob->gl_pathc +
((flags & GLOB_DOOFFS) ? ((flags & GLOB_DOOFFS) ?
pglob->gl_offs : 0) + pglob->gl_offs : 0) +
dirs.gl_pathc + 1) * dirs.gl_pathc + 1) *
sizeof (char *)); sizeof (char *));
if (pglob->gl_pathv == NULL) if (pglob->gl_pathv == NULL)
{ {
globfree (&dirs); globfree (&dirs);
return GLOB_NOSPACE; return GLOB_NOSPACE;
} }
if (flags & GLOB_DOOFFS) if (flags & GLOB_DOOFFS)
while (pglob->gl_pathc < pglob->gl_offs) while (pglob->gl_pathc < pglob->gl_offs)
pglob->gl_pathv[pglob->gl_pathc++] = NULL; pglob->gl_pathv[pglob->gl_pathc++] = NULL;
for (i = 0; i < dirs.gl_pathc; ++i) for (i = 0; i < dirs.gl_pathc; ++i)
{ {
const char *dir = dirs.gl_pathv[i]; const char *dir = dirs.gl_pathv[i];
size_t dir_len = strlen (dir); size_t dir_len = strlen (dir);
/* First check whether this really is a directory. */ /* First check whether this really is a directory. */
if (((flags & GLOB_ALTDIRFUNC) if (((flags & GLOB_ALTDIRFUNC)
? (*pglob->gl_stat) (dir, &st) : __stat (dir, &st)) != 0 ? (*pglob->gl_stat) (dir, &st) : __stat (dir, &st)) != 0
|| !S_ISDIR (st.st_mode)) || !S_ISDIR (st.st_mode))
/* No directory, ignore this entry. */ /* No directory, ignore this entry. */
continue; continue;
pglob->gl_pathv[pglob->gl_pathc] = malloc (dir_len + 1 pglob->gl_pathv[pglob->gl_pathc] = malloc (dir_len + 1
+ filename_len); + filename_len);
if (pglob->gl_pathv[pglob->gl_pathc] == NULL) if (pglob->gl_pathv[pglob->gl_pathc] == NULL)
{ {
globfree (&dirs); globfree (&dirs);
globfree (pglob); globfree (pglob);
return GLOB_NOSPACE; return GLOB_NOSPACE;
} }
#ifdef HAVE_MEMPCPY #ifdef HAVE_MEMPCPY
mempcpy (mempcpy (mempcpy (pglob->gl_pathv[pglob->gl_pathc], mempcpy (mempcpy (mempcpy (pglob->gl_pathv[pglob->gl_pathc],
dir, dir_len), dir, dir_len),
"/", 1), "/", 1),
filename, filename_len); filename, filename_len);
#else #else
memcpy (pglob->gl_pathv[pglob->gl_pathc], dir, dir_len); memcpy (pglob->gl_pathv[pglob->gl_pathc], dir, dir_len);
pglob->gl_pathv[pglob->gl_pathc][dir_len] = '/'; pglob->gl_pathv[pglob->gl_pathc][dir_len] = '/';
memcpy (&pglob->gl_pathv[pglob->gl_pathc][dir_len + 1], memcpy (&pglob->gl_pathv[pglob->gl_pathc][dir_len + 1],
filename, filename_len); filename, filename_len);
#endif #endif
++pglob->gl_pathc; ++pglob->gl_pathc;
} }
pglob->gl_pathv[pglob->gl_pathc] = NULL; pglob->gl_pathv[pglob->gl_pathc] = NULL;
pglob->gl_flags = flags; pglob->gl_flags = flags;
/* Now we know how large the gl_pathv vector must be. */ /* Now we know how large the gl_pathv vector must be. */
new_pathv = (char **) realloc (pglob->gl_pathv, new_pathv = (char **) realloc (pglob->gl_pathv,
((pglob->gl_pathc + 1) ((pglob->gl_pathc + 1)
* sizeof (char *))); * sizeof (char *)));
if (new_pathv != NULL) if (new_pathv != NULL)
pglob->gl_pathv = new_pathv; pglob->gl_pathv = new_pathv;
} }
else else
return GLOB_NOMATCH; return GLOB_NOMATCH;
}
globfree (&dirs); globfree (&dirs);
} }
@ -1352,10 +1356,12 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
save = errno; save = errno;
if (stream != NULL) if (stream != NULL)
if (flags & GLOB_ALTDIRFUNC) {
(*pglob->gl_closedir) (stream); if (flags & GLOB_ALTDIRFUNC)
else (*pglob->gl_closedir) (stream);
closedir ((DIR *) stream); else
closedir ((DIR *) stream);
}
__set_errno (save); __set_errno (save);
return nfound == 0 ? GLOB_NOMATCH : 0; return nfound == 0 ? GLOB_NOMATCH : 0;

View File

@ -283,10 +283,12 @@ gaih_inet (const char *name, const struct gaih_service *service,
((req->ai_socktype != tp->socktype) || !req->ai_socktype) && ((req->ai_socktype != tp->socktype) || !req->ai_socktype) &&
((req->ai_protocol != tp->protocol) || !req->ai_protocol); tp++); ((req->ai_protocol != tp->protocol) || !req->ai_protocol); tp++);
if (tp->name == NULL) if (tp->name == NULL)
if (req->ai_socktype) {
return (GAIH_OKIFUNSPEC | -EAI_SOCKTYPE); if (req->ai_socktype)
else return (GAIH_OKIFUNSPEC | -EAI_SOCKTYPE);
return (GAIH_OKIFUNSPEC | -EAI_SERVICE); else
return (GAIH_OKIFUNSPEC | -EAI_SERVICE);
}
} }
if (service != NULL) if (service != NULL)

View File

@ -278,7 +278,7 @@ extern void __process_machine_rela (struct link_map *map,
LOADADDR is the load address of the object; INFO is an array indexed LOADADDR is the load address of the object; INFO is an array indexed
by DT_* of the .dynamic section info. */ by DT_* of the .dynamic section info. */
extern void inline void
elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
const Elf32_Sym *sym, const struct r_found_version *version, const Elf32_Sym *sym, const struct r_found_version *version,
Elf32_Addr *const reloc_addr) Elf32_Addr *const reloc_addr)

View File

@ -26,8 +26,8 @@
#endif #endif
/* Some systems need this in order to declare localtime_r properly. */ /* Some systems need this in order to declare localtime_r properly. */
#ifndef _REENTRANT #ifndef __EXTENSIONS__
# define _REENTRANT 1 # define __EXTENSIONS__ 1
#endif #endif
#ifdef _LIBC #ifdef _LIBC

View File

@ -21,8 +21,8 @@
#endif #endif
/* Some hosts need this in order to declare localtime_r properly. */ /* Some hosts need this in order to declare localtime_r properly. */
#ifndef _REENTRANT #ifndef __EXTENSIONS__
# define _REENTRANT 1 # define __EXTENSIONS__ 1
#endif #endif
#ifdef _LIBC #ifdef _LIBC
@ -547,7 +547,7 @@ my_strftime (s, maxsize, format, tp)
len += strlen (f + len); len += strlen (f + len);
break; break;
} }
if (bytes == (size_t) -1) if (bytes == (size_t) -1)
{ {
len++; len++;

View File

@ -32,13 +32,15 @@ wcstok (wcs, delim, save_ptr)
wchar_t *result; wchar_t *result;
if (wcs == NULL) if (wcs == NULL)
if (*save_ptr == NULL) {
{ if (*save_ptr == NULL)
__set_errno (EINVAL); {
return NULL; __set_errno (EINVAL);
} return NULL;
else }
wcs = *save_ptr; else
wcs = *save_ptr;
}
/* Scan leading delimiters. */ /* Scan leading delimiters. */
wcs += wcsspn (wcs, delim); wcs += wcsspn (wcs, delim);