summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog181
-rw-r--r--NEWS16
-rw-r--r--argp/Makefile6
-rw-r--r--argp/argp-help.c78
-rw-r--r--argp/bug-argp1.c26
-rw-r--r--elf/dl-dst.h15
-rw-r--r--elf/dl-load.c9
-rw-r--r--fedora/branch.mk4
-rw-r--r--fedora/glibc.spec.in7
-rw-r--r--iconv/iconv_charmap.c24
-rw-r--r--include/arpa/nameser.h43
-rw-r--r--io/ftw.c5
-rw-r--r--locale/programs/ld-time.c13
-rw-r--r--locale/programs/locfile.c11
-rw-r--r--misc/sys/queue.h21
-rw-r--r--nis/nis_creategroup.c4
-rw-r--r--nis/nis_defaults.c125
-rw-r--r--nis/nis_lookup.c35
-rw-r--r--nis/nss-nis.h4
-rw-r--r--nis/nss-nisplus.h6
-rw-r--r--nis/nss_nis/nis-service.c29
-rw-r--r--nptl/ChangeLog22
-rw-r--r--nptl/pthread_atfork.c5
-rw-r--r--nptl/sysdeps/pthread/unwind-forcedunwind.c13
-rw-r--r--nptl/sysdeps/unix/sysv/linux/ia64/unwind-forcedunwind.c3
-rw-r--r--nss/nsswitch.c7
-rw-r--r--posix/getconf.c1
-rw-r--r--posix/wordexp.c53
-rw-r--r--resolv/nss_dns/dns-canon.c16
-rw-r--r--resolv/res_mkquery.c48
-rw-r--r--resolv/res_query.c6
-rw-r--r--resolv/res_send.c57
-rw-r--r--stdio-common/vfscanf.c128
-rw-r--r--stdlib/canonicalize.c4
-rw-r--r--string/argz-replace.c5
-rw-r--r--sunrpc/des_impl.c29
-rw-r--r--sunrpc/svc_udp.c10
-rw-r--r--sunrpc/svcauth_des.c4
-rw-r--r--sunrpc/xdr_ref.c3
-rw-r--r--sysdeps/generic/ldsodefs.h45
-rw-r--r--sysdeps/posix/getaddrinfo.c10
-rw-r--r--sysdeps/s390/s390-32/elf/start.S9
-rw-r--r--sysdeps/s390/s390-64/elf/start.S6
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/fcntl.h9
-rw-r--r--sysdeps/unix/sysv/linux/check_pf.c11
-rw-r--r--sysdeps/unix/sysv/linux/i386/bits/fcntl.h9
-rw-r--r--sysdeps/unix/sysv/linux/ia64/bits/fcntl.h9
-rw-r--r--sysdeps/unix/sysv/linux/ifaddrs.c8
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h9
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/fcntl.h9
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/syscall.S9
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/syscall.S9
-rw-r--r--sysdeps/unix/sysv/linux/sh/bits/fcntl.h9
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/fcntl.h9
-rw-r--r--sysdeps/unix/sysv/linux/tcgetattr.c47
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h9
56 files changed, 812 insertions, 490 deletions
diff --git a/ChangeLog b/ChangeLog
index 8c427ac75c..92259aa5b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,182 @@
+2006-05-10 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/tcgetattr.c (__tcgetattr): Only store
+ results if the call was succesful.
+
+ * nis/nss-nis.h: Mark __yperr2nss_tab and __yperr2nss_count as hidden.
+
+ * nis/nss-nisplus.h: Mark __niserr2nss_tab and __niserr2nss_count
+ as hidden.
+
+2006-05-10 Jakub Jelinek <jakub@redhat.com>
+
+ * misc/sys/queue.h: Remove uses of all QUEUEDEBUG_* macros.
+
+2006-05-10 Ulrich Drepper <drepper@redhat.com>
+
+ * posix/wordexp.c (parse_glob): No need to check ifs for NULL, the
+ caller makes sure this is not the case.
+ (wordexp): Simplify ifs_white creation. [Coverity CID 231]
+
+2006-05-09 Ulrich Drepper <drepper@redhat.com>
+
+ * posix/wordexp.c: Remove numerous NULL pointer tests before FREE
+ calls.
+
+ * io/ftw.c (open_dir_stream): Return right away if REALLOC fails.
+ [Coverity CID 229, 230]
+
+ * argp/argp-help.c (hol_entry_help): Handle STATE==NULL in ARG and
+ DGETTEXT calls.
+ (hol_help): Likewise. [Coverity CID 226, 227]
+
+ * string/argz-replace.c (__argz_replace): Unconditionally call
+ free on SRC. [Coverity CID 225]
+
+ * nis/nis_creategroup.c (nis_creategroup): No need to duplicate
+ the return value of __nis_default_owner and __nis_default_group,
+ it has been especially allocated. [Coverity CID 224]
+
+ * nis/nis_defaults.c (searchXYX): New functions. Used by both
+ searchgroup and searchowner. Significantly simplified.
+ (__nis_default_owner): Remove duplication. Do not locally copy the
+ string before duplicating it.
+ (__nis_default_group): Likewise.
+
+ * nis/nis_lookup.c (nis_lookup): After calling nis_free_directory,
+ we must clear the variable before calling __nisfind_server.
+
+ * nis/nis_lookup.c (nis_lookup): Always free memory allocated with
+ nis_getnames. [Coverity CID 223]
+
+ * locale/programs/locfile.c (locfile_read): Use alloca instead of
+ xmalloc to allocate local repertoire name. [Coverity CID 222]
+
+ * iconv/iconv_charmap.c (use_to_charmap): No need to dynamically
+ allocate memory for the input to add_bytes. [Coverity CID 221]
+
+ * posix/wordexp.c (w_addword): Free word if realloc fails and it
+ was allocated here. [Coverity CID 219, 220]
+
+ * posix/getconf.c (print_all): Free confstr data after printing.
+ [Coverity CID 218]
+
+ * sysdeps/posix/getaddrinfo.c (gaih_inet): Free canon string if
+ list allocation fails. [Coverity CID 215]
+
+ * nss/nsswitch.c (__nss_configure_lookup): Fix loop end condition.
+ [Coverity CID 213]
+
+ * argp/argp-help.c (hol_entry_cmp): Don't call canon_doc_option if
+ string is NULL. [Coverity CID 212]
+ * argp/Makefile: Add rules to build and run bug-argp1.
+ * argp/bug-argp1.c: New file.
+
+ * io/ftw.c (ftw_dir): Use __rawmemchr instead of strchr to find
+ end of string.
+ * stdlib/canonicalize.c (__realpath): Likewise.
+
+ * locale/programs/ld-time.c (time_finish): Don't dereference NULL
+ pointer. [Coverity CID 206]
+
+ * elf/dl-dst.h (DL_DST_REQUIRED): Be prepared for missing link map
+ in statically linked code.
+ * elf/dl-load.c (_dl_dst_substitute): When replacing ORIGIN in
+ statically built code, be prepared to have no link map.
+ [Coverity CID 205]
+
+ * argp/argp-help.c (fill_in_uparams): Handle STATE==NULL in
+ dgettext calls. [Coverity CID 204]
+
+ * argp/argp-help.c (struct uparams): Remove valid member. Change
+ the one user.
+ (uparam_names): Reduce size. Avoid relative relocations.
+ Moved to read-only segment.
+ (fill_in_uparams): Update for new layout.
+
+ * sysdeps/unix/sysv/linux/ifaddrs.c (getifaddrs): Parameter can be
+ assumed to always be != NULL. [Coverity CID 202]
+
+ * argp/argp-help.c (hol_entry_help): Remove some dead code
+ [Coverity CID 200].
+
+ * nis/nss_nis/nis-service.c (_nss_nis_getservbyport_r): Optimize
+ away a few more unconditional yperr2nss calls.
+ (_nss_nis_getservbyname_r): Likewise.
+
+2006-05-06 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/generic/ldsodefs.h: Remove support for non-core
+ architectures.
+
+ * sysdeps/unix/sysv/linux/check_pf.c (make_request): Make sure
+ that unused memory passed to sendto is nevertheless initialized.
+
+ [BZ #2499]
+ * resolv/nss_dns/dns-canon.c (_nss_dns_getcanonname_r): Avoid
+ possibly unaligned memory accesses.
+
+ * include/arpa/nameser.h: Also optimize NS_PUT16 and NS_PUT32.
+ * resolv/res_mkquery.c: Use NS_PUT16 and NS_PUT32 instead of __putshort
+ and __putlong respectively. Correct buffer overflow check for
+ NS_NOTIFY_OP.
+
+ * resolv/res_send.c (send_vc): Use ns_put16 instead of putshort.
+
+ * resolv/res_send.c (res_queriesmatch): Fix typo in comment.
+ (send_dg): Rewrite error handling to be more compact and avoid
+ double recomputation of timeouts. Pass MSG_NOSIGNAL to send.
+
+ * include/arpa/nameser.h: Add optimizations for NS_GET16 and NS_GET32.
+
+ * resolv/res_send.c (res_nameinquery): Use NS_GET16 directly
+ instead of ns_get16.
+ (res_queriesmatch): Likewise. Minor optimization.
+
+ [BZ #2499]
+ * resolv/res_query.c (__libc_res_nquery): If answerp != NULL,
+ __libc_res_nsend might reallocate the buffer for the answer. In
+ this case we have to reload the HP pointer.
+
+2006-05-05 Ulrich Drepper <drepper@redhat.com>
+
+ * stdio-common/vfscanf.c (memory_error): Remove definition. Add
+ some branch prediction hints.
+
+ * sysdeps/unix/sysv/linux/sparc/bits/fcntl.h: Define SPLICE_F_*.
+ * sysdeps/unix/sysv/linux/ia64/bits/fcntl.h: Likewise.
+ * sysdeps/unix/sysv/linux/sh/bits/fcntl.h: Likewise.
+ * sysdeps/unix/sysv/linux/i386/bits/fcntl.h: Likewise.
+ * sysdeps/unix/sysv/linux/s390/bits/fcntl.h: Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h: Likewise.
+ * sysdeps/unix/sysv/linux/alpha/bits/fcntl.h: Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h: Likewise.
+
+2006-05-05 Martin Schwidefsky <schwidefsky@de.ibm.com>
+
+ * sysdeps/s390/s390-32/elf/start.S: Replace pc relative relocation
+ by a GOT relocation to make Scrt1.o position independent.
+ * sysdeps/s390/s390-64/elf/start.S: Likewise.
+
+ * sysdeps/unix/sysv/linux/s390/s390-32/syscall.S: Add support for
+ six system call parameters.
+ * sysdeps/unix/sysv/linux/s390/s390-64/syscall.S: Likewise.
+
+2006-05-05 Ulrich Drepper <drepper@redhat.com>
+
+ * sunrpc/svcauth_des.c (cache_init): Use calloc instead of
+ malloc&bzero.
+
+ * sunrpc/svc_udp.c (BZERO): Remove definition.
+ (CALLOC): Define.
+ (svc_enablecache): Use CALLOC instead of ALLOC&BZERO.
+
+ * sunrpc/des_impl.c: Remove ALT_ECB support. We never used it.
+ (des_SPtrans): Use uint32_t type.
+ (des_skb): Likewise.
+
+ * sunrpc/xdr_ref.c (xdr_reference): Use calloc instead of malloc&bzero.
+
2006-05-05 Jakub Jelinek <jakub@redhat.com>
[BZ #2509]
@@ -7,7 +186,7 @@
2006-05-05 Ulrich Drepper <drepper@redhat.com>
* locale/programs/ld-address.c (address_finish): Fix one more
- place where the iso639 array might be access beyond the limits.
+ place where the iso639 array might be accessed beyond the limits.
2006-05-04 Ulrich Drepper <drepper@redhat.com>
diff --git a/NEWS b/NEWS
index 2a9ac22b65..006aa2989f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes. 2006-05-01
+GNU C Library NEWS -- history of user-visible changes. 2006-05-07
Copyright (C) 1992-2002,2003,2004,2005,2006 Free Software Foundation, Inc.
See the end for copying conditions.
@@ -10,10 +10,24 @@ Version 2.5
* For Linux, the sorting of addresses returned by getaddrinfo now also
handles rules 3 and 7 from RFC 3484. Implemented by Ulrich Drepper.
+* Allow system admin to configure getaddrinfo with the /etc/gai.conf file.
+ Implemented by Ulrich Drepper.
+
* New Linux interfaces: splice, tee, sync_file_range, vmsplace.
* New iconv module for MIK. Contributed by Alexander Shopov.
+* For sites with broken group and/or passwd database, the auto-propagate
+ option of nscd can prevent creating ID lookup entries from the results
+ of a name lookup and vice versa. This usually is no problem but some
+ site might have problems with default behavior.
+ Implemented by Ulrich Drepper.
+
+* Iterating over entire database in NIS and NIS+ can be slow. With the
+ SETENT_BATCH_READ option in /etc/default/nss a system admin can decide
+ to trade time for memory. The entire database will be read at once.
+ Implemented by Ulrich Drepper.
+
Version 2.4
diff --git a/argp/Makefile b/argp/Makefile
index a68ca1bee3..5ade517476 100644
--- a/argp/Makefile
+++ b/argp/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1997, 2002, 2003 Free Software Foundation, Inc.
+# Copyright (C) 1997, 2002, 2003, 2006 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -26,10 +26,12 @@ distribute = argp-fmtstream.h argp-namefrob.h
routines = $(addprefix argp-, ba fmtstream fs-xinl help parse pv \
pvh xinl eexst)
-tests = argp-test tst-argp1
+tests = argp-test tst-argp1 bug-argp1
CFLAGS-argp-help.c = $(uses-callbacks) -fexceptions
CFLAGS-argp-parse.c = $(uses-callbacks)
CFLAGS-argp-fmtstream.c = -fexceptions
+bug-argp1-ARGS = -- --help
+
include ../Rules
diff --git a/argp/argp-help.c b/argp/argp-help.c
index 4bc4d07b15..13c0820710 100644
--- a/argp/argp-help.c
+++ b/argp/argp-help.c
@@ -1,5 +1,5 @@
/* Hierarchial argument parsing help output
- Copyright (C) 1995-2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1995-2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
@@ -128,40 +128,37 @@ struct uparams
int header_col;
int usage_indent;
int rmargin;
-
- int valid; /* True when the values in here are valid. */
};
/* This is a global variable, as user options are only ever read once. */
static struct uparams uparams = {
DUP_ARGS, DUP_ARGS_NOTE,
SHORT_OPT_COL, LONG_OPT_COL, DOC_OPT_COL, OPT_DOC_COL, HEADER_COL,
- USAGE_INDENT, RMARGIN,
- 0
+ USAGE_INDENT, RMARGIN
};
/* A particular uparam, and what the user name is. */
struct uparam_name
{
- const char *name; /* User name. */
- int is_bool; /* Whether it's `boolean'. */
- size_t uparams_offs; /* Location of the (int) field in UPARAMS. */
+ const char name[14]; /* User name. */
+ bool is_bool; /* Whether it's `boolean'. */
+ uint8_t uparams_offs; /* Location of the (int) field in UPARAMS. */
};
/* The name-field mappings we know about. */
static const struct uparam_name uparam_names[] =
{
- { "dup-args", 1, offsetof (struct uparams, dup_args) },
- { "dup-args-note", 1, offsetof (struct uparams, dup_args_note) },
- { "short-opt-col", 0, offsetof (struct uparams, short_opt_col) },
- { "long-opt-col", 0, offsetof (struct uparams, long_opt_col) },
- { "doc-opt-col", 0, offsetof (struct uparams, doc_opt_col) },
- { "opt-doc-col", 0, offsetof (struct uparams, opt_doc_col) },
- { "header-col", 0, offsetof (struct uparams, header_col) },
- { "usage-indent", 0, offsetof (struct uparams, usage_indent) },
- { "rmargin", 0, offsetof (struct uparams, rmargin) },
- { 0 }
+ { "dup-args", true, offsetof (struct uparams, dup_args) },
+ { "dup-args-note", true, offsetof (struct uparams, dup_args_note) },
+ { "short-opt-col", false, offsetof (struct uparams, short_opt_col) },
+ { "long-opt-col", false, offsetof (struct uparams, long_opt_col) },
+ { "doc-opt-col", false, offsetof (struct uparams, doc_opt_col) },
+ { "opt-doc-col", false, offsetof (struct uparams, opt_doc_col) },
+ { "header-col", false, offsetof (struct uparams, header_col) },
+ { "usage-indent", false, offsetof (struct uparams, usage_indent) },
+ { "rmargin", false, offsetof (struct uparams, rmargin) }
};
+#define nuparam_names (sizeof (uparam_names) / sizeof (uparam_names[0]))
/* Read user options from the environment, and fill in UPARAMS appropiately. */
static void
@@ -217,22 +214,27 @@ fill_in_uparams (const struct argp_state *state)
SKIPWS (arg);
}
- for (un = uparam_names; un->name; un++)
+ un = uparam_names;
+ size_t u;
+ for (u = 0; u < nuparam_names; ++un, ++u)
if (strlen (un->name) == var_len
&& strncmp (var, un->name, var_len) == 0)
{
if (unspec && !un->is_bool)
__argp_failure (state, 0, 0,
- dgettext (state->root_argp->argp_domain, "\
+ dgettext (state == NULL ? NULL
+ : state->root_argp->argp_domain,
+ "\
%.*s: ARGP_HELP_FMT parameter requires a value"),
(int) var_len, var);
else
*(int *)((char *)&uparams + un->uparams_offs) = val;
break;
}
- if (! un->name)
+ if (u == nuparam_names)
__argp_failure (state, 0, 0,
- dgettext (state->root_argp->argp_domain, "\
+ dgettext (state == NULL ? NULL
+ : state->root_argp->argp_domain, "\
%.*s: Unknown ARGP_HELP_FMT parameter"),
(int) var_len, var);
@@ -243,7 +245,8 @@ fill_in_uparams (const struct argp_state *state)
else if (*var)
{
__argp_failure (state, 0, 0,
- dgettext (state->root_argp->argp_domain,
+ dgettext (state == NULL ? NULL
+ : state->root_argp->argp_domain,
"Garbage in ARGP_HELP_FMT: %s"), var);
break;
}
@@ -759,9 +762,9 @@ hol_entry_cmp (const struct hol_entry *entry1,
const char *long2 = hol_entry_first_long (entry2);
if (doc1)
- doc1 = canon_doc_option (&long1);
+ doc1 = long1 != NULL && canon_doc_option (&long1);
if (doc2)
- doc2 = canon_doc_option (&long2);
+ doc2 = long2 != NULL && canon_doc_option (&long2);
if (doc1 != doc2)
/* `documentation' options always follow normal options (or
@@ -1102,7 +1105,9 @@ hol_entry_help (struct hol_entry *entry, const struct argp_state *state,
__argp_fmtstream_putc (stream, '-');
__argp_fmtstream_putc (stream, *so);
if (!have_long_opt || uparams.dup_args)
- arg (real, " %s", "[%s]", state->root_argp->argp_domain, stream);
+ arg (real, " %s", "[%s]",
+ state == NULL ? NULL : state->root_argp->argp_domain,
+ stream);
else if (real->arg)
hhstate->suppressed_dup_arg = 1;
}
@@ -1122,26 +1127,22 @@ hol_entry_help (struct hol_entry *entry, const struct argp_state *state,
have been done on the original; but documentation options
should be pretty rare anyway... */
__argp_fmtstream_puts (stream,
- dgettext (state->root_argp->argp_domain,
+ dgettext (state == NULL ? NULL
+ : state->root_argp->argp_domain,
opt->name));
}
}
else
/* A real long option. */
{
- int first_long_opt = 1;
-
__argp_fmtstream_set_wmargin (stream, uparams.long_opt_col);
for (opt = real, num = entry->num; num > 0; opt++, num--)
if (opt->name && ovisible (opt))
{
comma (uparams.long_opt_col, &pest);
__argp_fmtstream_printf (stream, "--%s", opt->name);
- if (first_long_opt || uparams.dup_args)
- arg (real, "=%s", "[=%s]", state->root_argp->argp_domain,
- stream);
- else if (real->arg)
- hhstate->suppressed_dup_arg = 1;
+ arg (real, "=%s", "[=%s]",
+ state == NULL ? NULL : state->root_argp->argp_domain, stream);
}
}
@@ -1160,7 +1161,8 @@ hol_entry_help (struct hol_entry *entry, const struct argp_state *state,
}
else
{
- const char *tstr = real->doc ? dgettext (state->root_argp->argp_domain,
+ const char *tstr = real->doc ? dgettext (state == NULL ? NULL
+ : state->root_argp->argp_domain,
real->doc) : 0;
const char *fstr = filter_doc (tstr, real->key, entry->argp, state);
if (fstr && *fstr)
@@ -1208,7 +1210,8 @@ hol_help (struct hol *hol, const struct argp_state *state,
if (hhstate.suppressed_dup_arg && uparams.dup_args_note)
{
- const char *tstr = dgettext (state->root_argp->argp_domain, "\
+ const char *tstr = dgettext (state == NULL ? NULL
+ : state->root_argp->argp_domain, "\
Mandatory or optional arguments to long options are also mandatory or \
optional for any corresponding short options.");
const char *fstr = filter_doc (tstr, ARGP_KEY_HELP_DUP_ARGS_NOTE,
@@ -1555,8 +1558,7 @@ _help (const struct argp *argp, const struct argp_state *state, FILE *stream,
__flockfile (stream);
#endif
- if (! uparams.valid)
- fill_in_uparams (state);
+ fill_in_uparams (state);
fs = __argp_make_fmtstream (stream, 0, uparams.rmargin, 0);
if (! fs)
diff --git a/argp/bug-argp1.c b/argp/bug-argp1.c
new file mode 100644
index 0000000000..a28cf4b9c7
--- /dev/null
+++ b/argp/bug-argp1.c
@@ -0,0 +1,26 @@
+#include <argp.h>
+
+
+static const struct argp_option test_options[] =
+{
+ { NULL, 'a', NULL, OPTION_DOC, NULL },
+ { NULL, 'b', NULL, OPTION_DOC, NULL },
+ { NULL, 0, NULL, 0, NULL }
+};
+
+static struct argp test_argp =
+{
+ test_options
+};
+
+
+static int
+do_test (int argc, char *argv[])
+{
+ int i;
+ argp_parse (&test_argp, argc, argv, 0, &i, NULL);
+ return 0;
+}
+
+#define TEST_FUNCTION do_test (argc, argv)
+#include "../test-skeleton.c"
diff --git a/elf/dl-dst.h b/elf/dl-dst.h
index 42bd4185af..83d16bdb0e 100644
--- a/elf/dl-dst.h
+++ b/elf/dl-dst.h
@@ -1,5 +1,5 @@
/* Handling of dynamic sring tokens.
- Copyright (C) 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999,2001,2002,2003,2004,2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -50,6 +50,7 @@
\
First get the origin string if it is not available yet. \
This can only happen for the map of the executable. */ \
+ DL_DST_REQ_STATIC \
if ((l)->l_origin == NULL) \
{ \
assert ((l)->l_name[0] == '\0'); \
@@ -66,6 +67,18 @@
\
__len; })
+#ifdef SHARED
+# define DL_DST_REQ_STATIC /* nothing */
+#else
+# define DL_DST_REQ_STATIC \
+ if ((l) == NULL) \
+ { \
+ const char *origin = _dl_get_origin (); \
+ origin_len = (origin && origin != (char *) -1 ? strlen (origin) : 0); \
+ } \
+ else
+#endif
+
#ifndef IS_IN_rtld
# define _dl_get_origin GLRO(dl_get_origin)
# define _dl_dst_substitute GLRO(dl_dst_substitute)
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 29fdfd8f19..01e1572f51 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -266,7 +266,14 @@ _dl_dst_substitute (struct link_map *l, const char *name, char *result,
++name;
if ((len = is_dst (start, name, "ORIGIN", is_path,
INTUSE(__libc_enable_secure))) != 0)
- repl = l->l_origin;
+ {
+#ifndef SHARED
+ if (l == NULL)
+ repl = _dl_get_origin ();
+ else
+#endif
+ repl = l->l_origin;
+ }
else if ((len = is_dst (start, name, "PLATFORM", is_path, 0)) != 0)
repl = GLRO(dl_platform);
else if ((len = is_dst (start, name, "LIB", is_path, 0)) != 0)
diff --git a/fedora/branch.mk b/fedora/branch.mk
index 3c205c2369..3f536bb857 100644
--- a/fedora/branch.mk
+++ b/fedora/branch.mk
@@ -3,5 +3,5 @@ glibc-branch := fedora
glibc-base := HEAD
DIST_BRANCH := devel
COLLECTION := dist-fc4
-fedora-sync-date := 2006-05-05 14:43 UTC
-fedora-sync-tag := fedora-glibc-20060505T1443
+fedora-sync-date := 2006-05-11 13:25 UTC
+fedora-sync-tag := fedora-glibc-20060511T1325
diff --git a/fedora/glibc.spec.in b/fedora/glibc.spec.in
index 4dd9774515..bbdbce1284 100644
--- a/fedora/glibc.spec.in
+++ b/fedora/glibc.spec.in
@@ -1,4 +1,4 @@
-%define glibcrelease 6
+%define glibcrelease 7
%define auxarches i586 i686 athlon sparcv9 alphaev6
%define prelinkarches noarch
%define xenarches i686 athlon
@@ -1392,6 +1392,11 @@ rm -f *.filelist*
%endif
%changelog
+* Thu May 11 2006 Jakub Jelinek <jakub@redhat.com> 2.4.90-7
+- update from CVS
+ - fix tcgetattr (#177965)
+ - fix <sys/queue.h> (#191264)
+
* Fri May 5 2006 Jakub Jelinek <jakub@redhat.com> 2.4.90-6
- update from CVS
- rebuilt using fixed rpm
diff --git a/iconv/iconv_charmap.c b/iconv/iconv_charmap.c
index 328121edbe..a54d738120 100644
--- a/iconv/iconv_charmap.c
+++ b/iconv/iconv_charmap.c
@@ -365,19 +365,27 @@ use_to_charmap (const char *from_code, struct charmap_t *to_charmap)
if (outptr != (char *) outbuf)
{
/* We got some output. Good, use it. */
- struct charseq *newp;
+ union
+ {
+ struct charseq seq;
+ struct
+ {
+ const char *name;
+ uint32_t ucs4;
+ int nbytes;
+ unsigned char bytes[outlen];
+ } mem;
+ } new;
outlen = sizeof (outbuf) - outlen;
assert ((char *) outbuf + outlen == outptr);
- newp = (struct charseq *) xmalloc (sizeof (struct charseq)
- + outlen);
- newp->name = out->name;
- newp->ucs4 = out->ucs4;
- newp->nbytes = outlen;
- memcpy (newp->bytes, outbuf, outlen);
+ new.mem.name = out->name;
+ new.mem.ucs4 = out->ucs4;
+ new.mem.nbytes = outlen;
+ memcpy (new.mem.bytes, outbuf, outlen);
- add_bytes (rettbl, newp, out);
+ add_bytes (rettbl, &new.seq, out);
}
/* Clear any possible state left behind. */
diff --git a/include/arpa/nameser.h b/include/arpa/nameser.h
index 944fe732a6..449f5b452e 100644
--- a/include/arpa/nameser.h
+++ b/include/arpa/nameser.h
@@ -1 +1,44 @@
#include <resolv/arpa/nameser.h>
+
+/* If the machine allows unaligned access we can do better than using
+ the NS_GET16, NS_GET32, NS_PUT16, and NS_PUT32 macros from the
+ installed header. */
+#include <string.h>
+#include <stdint.h>
+#include <netinet/in.h>
+
+#if _STRING_ARCH_unaligned
+
+# undef NS_GET16
+# define NS_GET16(s, cp) \
+ do { \
+ uint16_t *t_cp = (uint16_t *) (cp); \
+ (s) = ntohs (*t_cp); \
+ (cp) += NS_INT16SZ; \
+ } while (0)
+
+# undef NS_GET32
+# define NS_GET32(l, cp) \
+ do { \
+ uint32_t *t_cp = (uint32_t *) (cp); \
+ (l) = ntohl (*t_cp); \
+ (cp) += NS_INT32SZ; \
+ } while (0)
+
+# undef NS_PUT16
+# define NS_PUT16(s, cp) \
+ do { \
+ uint16_t *t_cp = (uint16_t *) (cp); \
+ *t_cp = htons (s); \
+ (cp) += NS_INT16SZ; \
+ } while (0)
+
+# undef NS_PUT32
+# define NS_PUT32(l, cp) \
+ do { \
+ uint32_t *t_cp = (uint32_t *) (cp); \
+ *t_cp = htonl (l); \
+ (cp) += NS_INT32SZ; \
+ } while (0)
+
+#endif
diff --git a/io/ftw.c b/io/ftw.c
index e96076a203..413871744e 100644
--- a/io/ftw.c
+++ b/io/ftw.c
@@ -301,8 +301,7 @@ open_dir_stream (int *dfdp, struct ftw_data *data, struct dir_data *dirp)
int save_err = errno;
free (buf);
__set_errno (save_err);
- result = -1;
- break;
+ return -1;
}
buf = newp;
}
@@ -526,7 +525,7 @@ fail:
/* Next, update the `struct FTW' information. */
++data->ftw.level;
- startp = strchr (data->dirbuf, '\0');
+ startp = __rawmemchr (data->dirbuf, '\0');
/* There always must be a directory name. */
assert (startp != data->dirbuf);
if (startp[-1] != '/')
diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c
index 2d63275d3c..78aff7fee6 100644
--- a/locale/programs/ld-time.c
+++ b/locale/programs/ld-time.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
@@ -468,9 +468,14 @@ No definition for %s category found"), "LC_TIME"));
wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end start */
wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end end */
time->era_entries[idx].wname = (uint32_t *) wstr + 1;
- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end name */
- *wstr = L'\0';
- time->era_entries[idx].wformat = (uint32_t *) wstr + 1;
+ if (wstr != NULL)
+ {
+ wstr = wcschr (wstr + 1, L':'); /* end name */
+ *wstr = L'\0';
+ time->era_entries[idx].wformat = (uint32_t *) wstr + 1;
+ }
+ else
+ time->era_entries[idx].wformat = NULL;
}
}
diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c
index bc12fbb332..ae8ce73ce4 100644
--- a/locale/programs/locfile.c
+++ b/locale/programs/locfile.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@@ -155,10 +155,11 @@ argument to `%s' must be a single character"),
if (repertoire_name == NULL)
{
- repertoire_name = memcpy (xmalloc (arg->val.str.lenmb + 1),
- arg->val.str.startmb,
- arg->val.str.lenmb);
- ((char *) repertoire_name)[arg->val.str.lenmb] = '\0';
+ char *newp = alloca (arg->val.str.lenmb + 1);
+
+ *((char *) mempcpy (newp, arg->val.str.startmb,
+ arg->val.str.lenmb)) = '\0';
+ repertoire_name = newp;
}
break;
diff --git a/misc/sys/queue.h b/misc/sys/queue.h
index d709d48be5..b0e6b38c19 100644
--- a/misc/sys/queue.h
+++ b/misc/sys/queue.h
@@ -103,7 +103,6 @@ struct { \
} while (/*CONSTCOND*/0)
#define LIST_INSERT_AFTER(listelm, elm, field) do { \
- QUEUEDEBUG_LIST_OP((listelm), field) \
if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \
(listelm)->field.le_next->field.le_prev = \
&(elm)->field.le_next; \
@@ -112,7 +111,6 @@ struct { \
} while (/*CONSTCOND*/0)
#define LIST_INSERT_BEFORE(listelm, elm, field) do { \
- QUEUEDEBUG_LIST_OP((listelm), field) \
(elm)->field.le_prev = (listelm)->field.le_prev; \
(elm)->field.le_next = (listelm); \
*(listelm)->field.le_prev = (elm); \
@@ -120,7 +118,6 @@ struct { \
} while (/*CONSTCOND*/0)
#define LIST_INSERT_HEAD(head, elm, field) do { \
- QUEUEDEBUG_LIST_INSERT_HEAD((head), (elm), field) \
if (((elm)->field.le_next = (head)->lh_first) != NULL) \
(head)->lh_first->field.le_prev = &(elm)->field.le_next;\
(head)->lh_first = (elm); \
@@ -128,12 +125,10 @@ struct { \
} while (/*CONSTCOND*/0)
#define LIST_REMOVE(elm, field) do { \
- QUEUEDEBUG_LIST_OP((elm), field) \
if ((elm)->field.le_next != NULL) \
(elm)->field.le_next->field.le_prev = \
(elm)->field.le_prev; \
*(elm)->field.le_prev = (elm)->field.le_next; \
- QUEUEDEBUG_LIST_POSTREMOVE((elm), field) \
} while (/*CONSTCOND*/0)
#define LIST_FOREACH(var, head, field) \
@@ -387,7 +382,6 @@ struct { \
} while (/*CONSTCOND*/0)
#define TAILQ_INSERT_HEAD(head, elm, field) do { \
- QUEUEDEBUG_TAILQ_INSERT_HEAD((head), (elm), field) \
if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
(head)->tqh_first->field.tqe_prev = \
&(elm)->field.tqe_next; \
@@ -398,7 +392,6 @@ struct { \
} while (/*CONSTCOND*/0)
#define TAILQ_INSERT_TAIL(head, elm, field) do { \
- QUEUEDEBUG_TAILQ_INSERT_TAIL((head), (elm), field) \
(elm)->field.tqe_next = NULL; \
(elm)->field.tqe_prev = (head)->tqh_last; \
*(head)->tqh_last = (elm); \
@@ -406,7 +399,6 @@ struct { \
} while (/*CONSTCOND*/0)
#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
- QUEUEDEBUG_TAILQ_OP((listelm), field) \
if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
(elm)->field.tqe_next->field.tqe_prev = \
&(elm)->field.tqe_next; \
@@ -417,7 +409,6 @@ struct { \
} while (/*CONSTCOND*/0)
#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
- QUEUEDEBUG_TAILQ_OP((listelm), field) \
(elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
(elm)->field.tqe_next = (listelm); \
*(listelm)->field.tqe_prev = (elm); \
@@ -425,15 +416,12 @@ struct { \
} while (/*CONSTCOND*/0)
#define TAILQ_REMOVE(head, elm, field) do { \
- QUEUEDEBUG_TAILQ_PREREMOVE((head), (elm), field) \
- QUEUEDEBUG_TAILQ_OP((elm), field) \
if (((elm)->field.tqe_next) != NULL) \
(elm)->field.tqe_next->field.tqe_prev = \
(elm)->field.tqe_prev; \
else \
(head)->tqh_last = (elm)->field.tqe_prev; \
*(elm)->field.tqe_prev = (elm)->field.tqe_next; \
- QUEUEDEBUG_TAILQ_POSTREMOVE((elm), field); \
} while (/*CONSTCOND*/0)
#define TAILQ_FOREACH(var, head, field) \
@@ -486,8 +474,6 @@ struct { \
} while (/*CONSTCOND*/0)
#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
- QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
- QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field) \
(elm)->field.cqe_next = (listelm)->field.cqe_next; \
(elm)->field.cqe_prev = (listelm); \
if ((listelm)->field.cqe_next == (void *)(head)) \
@@ -498,8 +484,6 @@ struct { \
} while (/*CONSTCOND*/0)
#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \
- QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
- QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field) \
(elm)->field.cqe_next = (listelm); \
(elm)->field.cqe_prev = (listelm)->field.cqe_prev; \
if ((listelm)->field.cqe_prev == (void *)(head)) \
@@ -510,7 +494,6 @@ struct { \
} while (/*CONSTCOND*/0)
#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \
- QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
(elm)->field.cqe_next = (head)->cqh_first; \
(elm)->field.cqe_prev = (void *)(head); \
if ((head)->cqh_last == (void *)(head)) \
@@ -521,7 +504,6 @@ struct { \
} while (/*CONSTCOND*/0)
#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \
- QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
(elm)->field.cqe_next = (void *)(head); \
(elm)->field.cqe_prev = (head)->cqh_last; \
if ((head)->cqh_first == (void *)(head)) \
@@ -532,8 +514,6 @@ struct { \
} while (/*CONSTCOND*/0)
#define CIRCLEQ_REMOVE(head, elm, field) do { \
- QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
- QUEUEDEBUG_CIRCLEQ_ELM((head), (elm), field) \
if ((elm)->field.cqe_next == (void *)(head)) \
(head)->cqh_last = (elm)->field.cqe_prev; \
else \
@@ -544,7 +524,6 @@ struct { \
else \
(elm)->field.cqe_prev->field.cqe_next = \
(elm)->field.cqe_next; \
- QUEUEDEBUG_CIRCLEQ_POSTREMOVE((elm), field) \
} while (/*CONSTCOND*/0)
#define CIRCLEQ_FOREACH(var, head, field) \
diff --git a/nis/nis_creategroup.c b/nis/nis_creategroup.c
index a7808abf4b..0e9e13d5e5 100644
--- a/nis/nis_creategroup.c
+++ b/nis/nis_creategroup.c
@@ -52,8 +52,8 @@ nis_creategroup (const_nis_name group, unsigned int flags)
obj->zo_oid.ctime = obj->zo_oid.mtime = time (NULL);
obj->zo_name = strdup (leafbuf);
- obj->zo_owner = strdup (__nis_default_owner (NULL));
- obj->zo_group = strdup (__nis_default_group (NULL));
+ obj->zo_owner = __nis_default_owner (NULL);
+ obj->zo_group = __nis_default_group (NULL);
obj->zo_domain = strdup (domainbuf);
if (obj->zo_name == NULL || obj->zo_owner == NULL
|| obj->zo_group == NULL || obj->zo_domain == NULL)
diff --git a/nis/nis_defaults.c b/nis/nis_defaults.c
index f13578635a..59fbbe4b26 100644
--- a/nis/nis_defaults.c
+++ b/nis/nis_defaults.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997, 1998, 2004 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@@ -17,6 +17,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -30,45 +31,36 @@
** Some functions for parsing the -D param and NIS_DEFAULTS Environ
*/
static nis_name
-searchgroup (char *str)
+searchXYX (char *str, const char *what)
{
- char *cptr;
- int i;
+ assert (strlen (what) == 6);
+ assert (strncmp (str, what, 6) == 0);
+ str += 6; /* Points to the begin of the parameters. */
+
+ int i = 0;
+ while (str[i] != '\0' && str[i] != ':')
+ ++i;
+ if (i == 0) /* only "<WHAT>=" ? */
+ return strdup ("");
- cptr = strstr (str, "group=");
- if (cptr == NULL)
- return NULL;
+ return strndup (str, i);
+}
- cptr += 6; /* points to the begin of the group string */
- i = 0;
- while (cptr[i] != '\0' && cptr[i] != ':')
- i++;
- if (i == 0) /* only "group=" ? */
- return (nis_name) "";
- return strndup (cptr, i);
+static nis_name
+searchgroup (char *str)
+{
+ return searchXYX (str, "group=");
}
+
static nis_name
searchowner (char *str)
{
- char *cptr;
- int i;
-
- cptr = strstr (str, "owner=");
- if (cptr == NULL)
- return NULL;
-
- cptr += 6; /* points to the begin of the owner string */
- i = 0;
- while (cptr[i] != '\0' && cptr[i] != ':')
- i++;
- if (i == 0) /* only "owner=" ? */
- return strdup ("");
-
- return strndup (cptr, i);
+ return searchXYX (str, "owner=");
}
+
static uint32_t
searchttl (char *str)
{
@@ -358,86 +350,61 @@ searchaccess (char *str, unsigned int access)
return result;
}
+
nis_name
__nis_default_owner (char *defaults)
{
- char default_owner[NIS_MAXNAMELEN + 1];
- char *cptr, *dptr;
+ char *default_owner = NULL;
- strcpy (default_owner, nis_local_principal ());
+ char *cptr = defaults;
+ if (cptr == NULL)
+ cptr = getenv ("NIS_DEFAULTS");
- if (defaults != NULL)
+ if (cptr != NULL)
{
- dptr = strstr (defaults, "owner=");
+ char *dptr = strstr (cptr, "owner=");
if (dptr != NULL)
{
- char *p = searchowner (defaults);
- if (strlen (p) <= NIS_MAXNAMELEN)
- strcpy (default_owner, p);
+ char *p = searchowner (dptr);
+ if (p == NULL)
+ return NULL;
+ default_owner = strdupa (p);
free (p);
}
}
- else
- {
- cptr = getenv ("NIS_DEFAULTS");
- if (cptr != NULL)
- {
- dptr = strstr (cptr, "owner=");
- if (dptr != NULL)
- {
- char *p = searchowner (cptr);
- if (strlen (p) <= NIS_MAXNAMELEN)
- strcpy (default_owner, p);
- free (p);
- }
- }
- }
- return strdup (default_owner);
+ return strdup (default_owner ?: nis_local_principal ());
}
libnsl_hidden_def (__nis_default_owner)
+
nis_name
__nis_default_group (char *defaults)
{
- char default_group[NIS_MAXNAMELEN + 1];
- char *cptr, *dptr;
+ char *default_group = NULL;
- strcpy (default_group, nis_local_group ());
+ char *cptr = defaults;
+ if (cptr == NULL)
+ cptr = getenv ("NIS_DEFAULTS");
- if (defaults != NULL)
+ if (cptr != NULL)
{
- dptr = strstr (defaults, "group=");
+ char *dptr = strstr (cptr, "group=");
if (dptr != NULL)
{
- char *p = searchgroup (defaults);
-
- if (strlen (p) <= NIS_MAXNAMELEN)
- strcpy (default_group, p);
+ char *p = searchgroup (dptr);
+ if (p == NULL)
+ return NULL;
+ default_group = strdupa (p);
free (p);
}
}
- else
- {
- cptr = getenv ("NIS_DEFAULTS");
- if (cptr != NULL)
- {
- dptr = strstr (cptr, "group=");
- if (dptr != NULL)
- {
- char *p = searchgroup (cptr);
-
- if (strlen (p) <= NIS_MAXNAMELEN)
- strcpy (default_group, p);
- free (p);
- }
- }
- }
- return strdup (default_group);
+ return strdup (default_group ?: nis_local_group ());
}
libnsl_hidden_def (__nis_default_group)
+
uint32_t
__nis_default_ttl (char *defaults)
{
diff --git a/nis/nis_lookup.c b/nis/nis_lookup.c
index 4cb34dd1a8..821b9bce73 100644
--- a/nis/nis_lookup.c
+++ b/nis/nis_lookup.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1997-1999, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997.
@@ -65,7 +65,7 @@ nis_lookup (const_nis_name name, const unsigned int flags)
if (status != NIS_SUCCESS)
{
NIS_RES_STATUS (res) = status;
- return res;
+ goto out;
}
status = __nisbind_create (&bptr, dir->do_servers.do_servers_val,
@@ -74,7 +74,7 @@ nis_lookup (const_nis_name name, const unsigned int flags)
{
NIS_RES_STATUS (res) = status;
nis_free_directory (dir);
- return res;
+ goto out;;
}
while (__nisbind_connect (&bptr) != NIS_SUCCESS)
@@ -83,7 +83,7 @@ nis_lookup (const_nis_name name, const unsigned int flags)
{
nis_free_directory (dir);
NIS_RES_STATUS (res) = NIS_NAMEUNREACHABLE;
- return res;
+ goto out;
}
}
@@ -121,8 +121,21 @@ nis_lookup (const_nis_name name, const unsigned int flags)
req.ns_name =
strdup (NIS_RES_OBJECT (res)->LI_data.li_name);
if (req.ns_name == NULL)
- return NULL;
+ {
+ nis_free_directory (dir);
+ res = NULL;
+ goto out;
+ }
+ /* The following is a non-obvious optimization. A
+ nis_freeresult call would call xdr_free as the
+ following code. But it also would unnecessarily
+ free the result structure. We avoid this here
+ along with the necessary tests. */
+#if 1
+ xdr_free ((xdrproc_t) _xdr_nis_result, (char *) res);
+ memset (res, '\0', sizeof (*res));
+#else
nis_freeresult (res);
res = calloc (1, sizeof (nis_result));
if (res == NULL)
@@ -130,6 +143,7 @@ nis_lookup (const_nis_name name, const unsigned int flags)
__nisbind_destroy (&bptr);
return NULL;
}
+#endif
link_first_try = 1; /* Try at first the old binding */
goto again;
@@ -144,10 +158,12 @@ nis_lookup (const_nis_name name, const unsigned int flags)
{
__nisbind_destroy (&bptr);
nis_free_directory (dir);
+ /* Otherwise __nisfind_server will not do anything. */
+ dir = NULL;
if (__nisfind_server (req.ns_name, &dir)
!= NIS_SUCCESS)
- return res;
+ goto out;
if (__nisbind_create (&bptr,
dir->do_servers.do_servers_val,
@@ -155,7 +171,7 @@ nis_lookup (const_nis_name name, const unsigned int flags)
flags) != NIS_SUCCESS)
{
nis_free_directory (dir);
- return res;
+ goto out;
}
}
else
@@ -167,7 +183,7 @@ nis_lookup (const_nis_name name, const unsigned int flags)
if (__nisbind_next (&bptr) != NIS_SUCCESS)
{
nis_free_directory (dir);
- return res;
+ goto out;
}
}
goto again;
@@ -184,7 +200,7 @@ nis_lookup (const_nis_name name, const unsigned int flags)
if (status != NIS_SUCCESS)
{
NIS_RES_STATUS (res) = status;
- return res;
+ goto out;
}
switch (NIS_RES_STATUS (res))
@@ -216,6 +232,7 @@ nis_lookup (const_nis_name name, const unsigned int flags)
}
}
+ out:
if (names != namebuf)
nis_freenames (names);
diff --git a/nis/nss-nis.h b/nis/nss-nis.h
index 5ac968e28e..a02583d14c 100644
--- a/nis/nss-nis.h
+++ b/nis/nss-nis.h
@@ -25,8 +25,8 @@
/* Convert YP error number to NSS error number. */
-extern const enum nss_status __yperr2nss_tab[];
-extern const unsigned int __yperr2nss_count;
+extern const enum nss_status __yperr2nss_tab[] attribute_hidden;
+extern const unsigned int __yperr2nss_count attribute_hidden;
static inline enum nss_status
yperr2nss (int errval)
diff --git a/nis/nss-nisplus.h b/nis/nss-nisplus.h
index 7235c355b0..ad7f444440 100644
--- a/nis/nss-nisplus.h
+++ b/nis/nss-nisplus.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997.
@@ -26,8 +26,8 @@
/* Convert NIS+ error number to NSS error number. */
-extern const enum nss_status __niserr2nss_tab[];
-extern const unsigned int __niserr2nss_count;
+extern const enum nss_status __niserr2nss_tab[] attribute_hidden;
+extern const unsigned int __niserr2nss_count attribute_hidden;
static inline enum nss_status
niserr2nss (int errval)
diff --git a/nis/nss_nis/nis-service.c b/nis/nss_nis/nis-service.c
index cb728335f9..c0e064d9a4 100644
--- a/nis/nss_nis/nis-service.c
+++ b/nis/nss_nis/nis-service.c
@@ -280,14 +280,13 @@ _nss_nis_getservbyname_r (const char *name, const char *protocol,
char *result;
int int_len;
- enum nss_status status = yperr2nss (yp_match (domain,
- "services.byservicename", key,
- keylen, &result, &int_len));
+ int status = yp_match (domain, "services.byservicename", key,
+ keylen, &result, &int_len);
size_t len = int_len;
/* If we found the key, it's ok and parse the result. If not,
fall through and parse the complete table. */
- if (__builtin_expect (status == NSS_STATUS_SUCCESS, 1))
+ if (__builtin_expect (status == YPERR_SUCCESS, 1))
{
if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
{
@@ -317,7 +316,7 @@ _nss_nis_getservbyname_r (const char *name, const char *protocol,
/* Check if it is safe to rely on services.byservicename. */
if (_nsl_default_nss () & NSS_FLAG_SERVICES_AUTHORITATIVE)
- return status;
+ return yperr2nss (status);
struct ypall_callback ypcb;
struct search_t req;
@@ -332,10 +331,10 @@ _nss_nis_getservbyname_r (const char *name, const char *protocol,
req.buflen = buflen;
req.errnop = errnop;
req.status = NSS_STATUS_NOTFOUND;
- status = yperr2nss (yp_all (domain, "services.byname", &ypcb));
+ status = yp_all (domain, "services.byname", &ypcb);
- if (status != NSS_STATUS_SUCCESS)
- return status;
+ if (__builtin_expect (status != YPERR_SUCCESS, 0))
+ return yperr2nss (status);
return req.status;
}
@@ -362,14 +361,13 @@ _nss_nis_getservbyport_r (int port, const char *protocol,
char *result;
int int_len;
- enum nss_status status = yperr2nss (yp_match (domain, "services.byname",
- key, keylen, &result,
- &int_len));
+ int status = yp_match (domain, "services.byname", key, keylen, &result,
+ &int_len);
size_t len = int_len;
/* If we found the key, it's ok and parse the result. If not,
fall through and parse the complete table. */
- if (status == NSS_STATUS_SUCCESS)
+ if (__builtin_expect (status == YPERR_SUCCESS, 1))
{
if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
{
@@ -414,11 +412,10 @@ _nss_nis_getservbyport_r (int port, const char *protocol,
req.buflen = buflen;
req.errnop = errnop;
req.status = NSS_STATUS_NOTFOUND;
- enum nss_status status = yperr2nss (yp_all (domain, "services.byname",
- &ypcb));
+ int status = yp_all (domain, "services.byname", &ypcb);
- if (status != NSS_STATUS_SUCCESS)
- return status;
+ if (__builtin_expect (status != YPERR_SUCCESS, 0))
+ return yperr2nss (status);
return req.status;
}
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 1f6ea95800..80eb4ad9f3 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,25 @@
+2006-05-10 Ulrich Drepper <drepper@redhat.com>
+
+ * pthread_atfork.c: Mark __dso_handle as hidden.
+
+2006-05-09 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #2644]
+ * sysdeps/pthread/unwind-forcedunwind.c: Different solution for
+ the reload problem. Change the one path in pthread_cancel_init
+ which causes the problem. Force gcc to reload. Simplify callers.
+ * sysdeps/unix/sysv/linux/ia64/unwind-forcedunwind.c
+ (_Unwind_GetBSP): Undo last patch.
+
+2006-05-07 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/ia64/unwind-forcedunwind.c: Make sure the
+ function pointer is reloaded after pthread_cancel_init calls.
+
+ [BZ #2644]
+ * sysdeps/pthread/unwind-forcedunwind.c: Make sure functions
+ pointers are reloaded after pthread_cancel_init calls.
+
2006-05-01 Ulrich Drepper <drepper@redhat.com>
* sysdeps/pthread/allocalim.h (__libc_use_alloca): Mark with
diff --git a/nptl/pthread_atfork.c b/nptl/pthread_atfork.c
index 6437d64906..b2495c7022 100644
--- a/nptl/pthread_atfork.c
+++ b/nptl/pthread_atfork.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -38,7 +38,8 @@
#include <fork.h>
/* This is defined by newer gcc version unique for each module. */
-extern void *__dso_handle __attribute__ ((__weak__));
+extern void *__dso_handle __attribute__ ((__weak__,
+ __visibility__ ("hidden")));
/* Hide the symbol so that no definition but the one locally in the
diff --git a/nptl/sysdeps/pthread/unwind-forcedunwind.c b/nptl/sysdeps/pthread/unwind-forcedunwind.c
index 9a38704aeb..6792d719d3 100644
--- a/nptl/sysdeps/pthread/unwind-forcedunwind.c
+++ b/nptl/sysdeps/pthread/unwind-forcedunwind.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>.
@@ -31,13 +31,18 @@ static _Unwind_Reason_Code (*libgcc_s_forcedunwind)
static _Unwind_Word (*libgcc_s_getcfa) (struct _Unwind_Context *);
void
+__attribute_noinline__
pthread_cancel_init (void)
{
void *resume, *personality, *forcedunwind, *getcfa;
void *handle;
if (__builtin_expect (libgcc_s_getcfa != NULL, 1))
- return;
+ {
+ /* Force gcc to reload all values. */
+ asm volatile ("" ::: "memory");
+ return;
+ }
handle = __libc_dlopen ("libgcc_s.so.1");
@@ -68,6 +73,7 @@ _Unwind_Resume (struct _Unwind_Exception *exc)
{
if (__builtin_expect (libgcc_s_resume == NULL, 0))
pthread_cancel_init ();
+
libgcc_s_resume (exc);
}
@@ -79,6 +85,7 @@ __gcc_personality_v0 (int version, _Unwind_Action actions,
{
if (__builtin_expect (libgcc_s_personality == NULL, 0))
pthread_cancel_init ();
+
return libgcc_s_personality (version, actions, exception_class,
ue_header, context);
}
@@ -89,6 +96,7 @@ _Unwind_ForcedUnwind (struct _Unwind_Exception *exc, _Unwind_Stop_Fn stop,
{
if (__builtin_expect (libgcc_s_forcedunwind == NULL, 0))
pthread_cancel_init ();
+
return libgcc_s_forcedunwind (exc, stop, stop_argument);
}
@@ -97,5 +105,6 @@ _Unwind_GetCFA (struct _Unwind_Context *context)
{
if (__builtin_expect (libgcc_s_getcfa == NULL, 0))
pthread_cancel_init ();
+
return libgcc_s_getcfa (context);
}
diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/unwind-forcedunwind.c b/nptl/sysdeps/unix/sysv/linux/ia64/unwind-forcedunwind.c
index fb44b426bc..d0c77a62e6 100644
--- a/nptl/sysdeps/unix/sysv/linux/ia64/unwind-forcedunwind.c
+++ b/nptl/sysdeps/unix/sysv/linux/ia64/unwind-forcedunwind.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>.
@@ -34,5 +34,6 @@ _Unwind_GetBSP (struct _Unwind_Context *context)
{
if (__builtin_expect (libgcc_s_getbsp == NULL, 0))
pthread_cancel_init ();
+
return libgcc_s_getbsp (context);
}
diff --git a/nss/nsswitch.c b/nss/nsswitch.c
index 7e5e6e8164..21174dfbab 100644
--- a/nss/nsswitch.c
+++ b/nss/nsswitch.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005
+/* Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -70,6 +70,7 @@ static const struct
#include "databases.def"
#undef DEFINE_DATABASE
};
+#define ndatabases (sizeof (databases) / sizeof (databases[0]))
__libc_lock_define_initialized (static, lock)
@@ -211,7 +212,7 @@ __nss_configure_lookup (const char *dbname, const char *service_line)
service_user *new_db;
size_t cnt;
- for (cnt = 0; cnt < sizeof databases; ++cnt)
+ for (cnt = 0; cnt < ndatabases; ++cnt)
{
int cmp = strcmp (dbname, databases[cnt].name);
if (cmp == 0)
@@ -223,7 +224,7 @@ __nss_configure_lookup (const char *dbname, const char *service_line)
}
}
- if (cnt == sizeof databases)
+ if (cnt == ndatabases)
{
__set_errno (EINVAL);
return -1;
diff --git a/posix/getconf.c b/posix/getconf.c
index 66e582e995..3c5ffe454c 100644
--- a/posix/getconf.c
+++ b/posix/getconf.c
@@ -981,6 +981,7 @@ print_all (const char *path)
if (confstr (c->call_name, cvalue, clen) != clen)
error (3, errno, "confstr");
printf ("%.*s\n", (int) clen, cvalue);
+ free (cvalue);
break;
}
}
diff --git a/posix/wordexp.c b/posix/wordexp.c
index 2eb58089c4..adece95ef8 100644
--- a/posix/wordexp.c
+++ b/posix/wordexp.c
@@ -1,5 +1,5 @@
/* POSIX.2 wordexp implementation.
- Copyright (C) 1997-2002, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1997-2002, 2003, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Tim Waugh <tim@cyberelk.demon.co.uk>.
@@ -166,6 +166,7 @@ w_addword (wordexp_t *pwordexp, char *word)
/* Add a word to the wordlist */
size_t num_p;
char **new_wordv;
+ bool allocated = false;
/* Internally, NULL acts like "". Convert NULLs to "" before
* the caller sees them.
@@ -175,6 +176,7 @@ w_addword (wordexp_t *pwordexp, char *word)
word = __strdup ("");
if (word == NULL)
goto no_space;
+ allocated = true;
}
num_p = 2 + pwordexp->we_wordc + pwordexp->we_offs;
@@ -187,6 +189,9 @@ w_addword (wordexp_t *pwordexp, char *word)
return 0;
}
+ if (allocated)
+ free (word);
+
no_space:
return WRDE_NOSPACE;
}
@@ -448,8 +453,7 @@ parse_glob (char **word, size_t *word_length, size_t *max_length,
glob_list.we_offs = 0;
for (; words[*offset] != '\0'; ++*offset)
{
- if ((ifs && strchr (ifs, words[*offset])) ||
- (!ifs && strchr (" \t\n", words[*offset])))
+ if (strchr (ifs, words[*offset]) != NULL)
/* Reached IFS */
break;
@@ -1162,9 +1166,8 @@ parse_comm (char **word, size_t *word_length, size_t *max_length,
return WRDE_NOSPACE;
}
- /* Premature end */
- if (comm)
- free (comm);
+ /* Premature end. */
+ free (comm);
return WRDE_SYNTAX;
}
@@ -1425,8 +1428,7 @@ envsubst:
&buffer[20], 10, 0);
*word = w_addstr (*word, word_length, max_length, value);
free (env);
- if (pattern)
- free (pattern);
+ free (pattern);
return *word ? 0 : WRDE_NOSPACE;
}
/* Is it `$*' or `$@' (unquoted) ? */
@@ -1599,8 +1601,7 @@ envsubst:
if (free_value)
free (value);
- if (expanded)
- free (expanded);
+ free (expanded);
goto do_error;
}
@@ -1620,8 +1621,7 @@ envsubst:
if (free_value)
free (value);
- if (expanded)
- free (expanded);
+ free (expanded);
goto do_error;
}
@@ -1643,8 +1643,7 @@ envsubst:
goto no_space;
}
- if (pattern)
- free (pattern);
+ free (pattern);
pattern = expanded;
}
@@ -1858,7 +1857,7 @@ envsubst:
goto success;
}
- if (free_value && value)
+ if (free_value)
free (value);
value = pattern ? __strdup (pattern) : pattern;
@@ -1875,8 +1874,10 @@ envsubst:
}
}
- free (env); env = NULL;
- free (pattern); pattern = NULL;
+ free (env);
+ env = NULL;
+ free (pattern);
+ pattern = NULL;
if (seen_hash)
{
@@ -1991,11 +1992,9 @@ syntax:
error = WRDE_SYNTAX;
do_error:
- if (env)
- free (env);
+ free (env);
- if (pattern)
- free (pattern);
+ free (pattern);
return error;
}
@@ -2265,7 +2264,7 @@ wordexp (const char *words, wordexp_t *pwordexp, int flags)
*/
ifs = getenv ("IFS");
- if (!ifs)
+ if (ifs == NULL)
/* IFS unset - use <space><tab><newline>. */
ifs = strcpy (ifs_white, " \t\n");
else
@@ -2273,18 +2272,15 @@ wordexp (const char *words, wordexp_t *pwordexp, int flags)
char *ifsch = ifs;
char *whch = ifs_white;
- /* Start off with no whitespace IFS characters */
- ifs_white[0] = '\0';
-
while (*ifsch != '\0')
{
- if ((*ifsch == ' ') || (*ifsch == '\t') || (*ifsch == '\n'))
+ if (*ifsch == ' ' || *ifsch == '\t' || *ifsch == '\n')
{
/* Whitespace IFS. See first whether it is already in our
collection. */
char *runp = ifs_white;
- while (runp < whch && *runp != '\0' && *runp != *ifsch)
+ while (runp < whch && *runp != *ifsch)
++runp;
if (runp == whch)
@@ -2443,8 +2439,7 @@ do_error:
* set pwordexp members back to what they were.
*/
- if (word != NULL)
- free (word);
+ free (word);
if (error == WRDE_NOSPACE)
return WRDE_NOSPACE;
diff --git a/resolv/nss_dns/dns-canon.c b/resolv/nss_dns/dns-canon.c
index 91708df51f..fca6cd8997 100644
--- a/resolv/nss_dns/dns-canon.c
+++ b/resolv/nss_dns/dns-canon.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
@@ -40,6 +40,10 @@ typedef union querybuf
} querybuf;
+static const short int qtypes[] = { ns_t_a, ns_t_aaaa };
+#define nqtypes (sizeof (qtypes) / sizeof (qtypes[0]))
+
+
enum nss_status
_nss_dns_getcanonname_r (const char *name, char *buffer, size_t buflen,
char **result,int *errnop, int *h_errnop)
@@ -53,8 +57,6 @@ _nss_dns_getcanonname_r (const char *name, char *buffer, size_t buflen,
unsigned char *ptr;
} ansp = { .ptr = buf };
enum nss_status status = NSS_STATUS_UNAVAIL;
- int qtypes[] = { ns_t_a, ns_t_aaaa };
-#define nqtypes (sizeof (qtypes) / sizeof (qtypes[0]))
for (int i = 0; i < nqtypes; ++i)
{
@@ -101,7 +103,8 @@ _nss_dns_getcanonname_r (const char *name, char *buffer, size_t buflen,
ptr += s;
/* Check whether type and class match. */
- unsigned int type = ntohs (*(uint16_t *) ptr);
+ uint_fast16_t type;
+ NS_GET16 (type, ptr);
if (type == qtypes[i])
{
/* We found the record. */
@@ -130,15 +133,14 @@ _nss_dns_getcanonname_r (const char *name, char *buffer, size_t buflen,
if (type != ns_t_cname)
goto unavail;
- ptr += sizeof (uint16_t);
- if (*(uint16_t *) ptr != htons (ns_c_in))
+ if (ns_get16 (ptr) != ns_c_in)
goto unavail;
/* Also skip over the TTL. */
ptr += sizeof (uint16_t) + sizeof (uint32_t);
/* Skip over the data length and data. */
- ptr += sizeof (uint16_t) + ntohs (*(uint16_t *) ptr);
+ ptr += sizeof (uint16_t) + ns_get16 (ptr);
}
}
}
diff --git a/resolv/res_mkquery.c b/resolv/res_mkquery.c
index 815fcf8ab3..4d98b8c5e8 100644
--- a/resolv/res_mkquery.c
+++ b/resolv/res_mkquery.c
@@ -131,13 +131,13 @@ res_nmkquery(res_state statp,
int randombits;
do
{
-#ifdef RANDOM_BITS
+# ifdef RANDOM_BITS
RANDOM_BITS (randombits);
-#else
+# else
struct timeval tv;
__gettimeofday (&tv, NULL);
randombits = (tv.tv_sec << 8) ^ tv.tv_usec;
-#endif
+# endif
}
while ((randombits & 0xffff) == 0);
statp->id = (statp->id + randombits) & 0xffff;
@@ -155,38 +155,36 @@ res_nmkquery(res_state statp,
* perform opcode specific processing
*/
switch (op) {
- case QUERY: /*FALLTHROUGH*/
case NS_NOTIFY_OP:
+ if ((buflen -= QFIXEDSZ + (data == NULL ? 0 : RRFIXEDSZ)) < 0)
+ return (-1);
+ goto compose;
+
+ case QUERY:
if ((buflen -= QFIXEDSZ) < 0)
return (-1);
+ compose:
if ((n = dn_comp(dname, cp, buflen, dnptrs, lastdnptr)) < 0)
return (-1);
cp += n;
buflen -= n;
- __putshort(type, cp);
- cp += INT16SZ;
- __putshort(class, cp);
- cp += INT16SZ;
+ NS_PUT16 (type, cp);
+ NS_PUT16 (class, cp);
hp->qdcount = htons(1);
if (op == QUERY || data == NULL)
break;
/*
* Make an additional record for completion domain.
*/
- buflen -= RRFIXEDSZ;
n = dn_comp((char *)data, cp, buflen, dnptrs, lastdnptr);
- if (n < 0)
+ if (__builtin_expect (n < 0, 0))
return (-1);
cp += n;
buflen -= n;
- __putshort(T_NULL, cp);
- cp += INT16SZ;
- __putshort(class, cp);
- cp += INT16SZ;
- __putlong(0, cp);
- cp += INT32SZ;
- __putshort(0, cp);
- cp += INT16SZ;
+ NS_PUT16 (T_NULL, cp);
+ NS_PUT16 (class, cp);
+ NS_PUT32 (0, cp);
+ NS_PUT16 (0, cp);
hp->arcount = htons(1);
break;
@@ -194,17 +192,13 @@ res_nmkquery(res_state statp,
/*
* Initialize answer section
*/
- if (buflen < 1 + RRFIXEDSZ + datalen)
+ if (__builtin_expect (buflen < 1 + RRFIXEDSZ + datalen, 0))
return (-1);
*cp++ = '\0'; /* no domain name */
- __putshort(type, cp);
- cp += INT16SZ;
- __putshort(class, cp);
- cp += INT16SZ;
- __putlong(0, cp);
- cp += INT32SZ;
- __putshort(datalen, cp);
- cp += INT16SZ;
+ NS_PUT16 (type, cp);
+ NS_PUT16 (class, cp);
+ NS_PUT32 (0, cp);
+ NS_PUT16 (datalen, cp);
if (datalen) {
memcpy(cp, data, datalen);
cp += datalen;
diff --git a/resolv/res_query.c b/resolv/res_query.c
index 0feba6687a..85bad97d2d 100644
--- a/resolv/res_query.c
+++ b/resolv/res_query.c
@@ -69,6 +69,7 @@ static const char sccsid[] = "@(#)res_query.c 8.1 (Berkeley) 6/4/93";
static const char rcsid[] = "$BINDId: res_query.c,v 8.20 2000/02/29 05:39:12 vixie Exp $";
#endif /* LIBC_SCCS and not lint */
+#include <assert.h>
#include <sys/types.h>
#include <sys/param.h>
#include <netinet/in.h>
@@ -151,6 +152,7 @@ __libc_res_nquery(res_state statp,
free (buf);
return (n);
}
+ assert (answerp == NULL || (void *) *answerp == (void *) answer);
n = __libc_res_nsend(statp, buf, n, answer, anslen, answerp);
if (use_malloc)
free (buf);
@@ -163,6 +165,10 @@ __libc_res_nquery(res_state statp,
return (n);
}
+ if (answerp != NULL)
+ /* __libc_res_nsend might have reallocated the buffer. */
+ hp = (HEADER *) *answerp;
+
if (hp->rcode != NOERROR || ntohs(hp->ancount) == 0) {
#ifdef DEBUG
if (statp->options & RES_DEBUG)
diff --git a/resolv/res_send.c b/resolv/res_send.c
index ff7be11509..887d048e19 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -267,8 +267,8 @@ res_nameinquery(const char *name, int type, int class,
cp += n;
if (cp + 2 * INT16SZ > eom)
return (-1);
- ttype = ns_get16(cp); cp += INT16SZ;
- tclass = ns_get16(cp); cp += INT16SZ;
+ NS_GET16(ttype, cp);
+ NS_GET16(tclass, cp);
if (ttype == type && tclass == class &&
ns_samename(tname, name) == 1)
return (1);
@@ -292,9 +292,6 @@ int
res_queriesmatch(const u_char *buf1, const u_char *eom1,
const u_char *buf2, const u_char *eom2)
{
- const u_char *cp = buf1 + HFIXEDSZ;
- int qdcount = ntohs(((HEADER*)buf1)->qdcount);
-
if (buf1 + HFIXEDSZ > eom1 || buf2 + HFIXEDSZ > eom2)
return (-1);
@@ -306,8 +303,16 @@ res_queriesmatch(const u_char *buf1, const u_char *eom1,
(((HEADER *)buf2)->opcode == ns_o_update))
return (1);
- if (qdcount != ntohs(((HEADER*)buf2)->qdcount))
+ /* Note that we initially do not convert QDCOUNT to the host byte
+ order. We can compare it with the second buffer's QDCOUNT
+ value without doing this. */
+ int qdcount = ((HEADER*)buf1)->qdcount;
+ if (qdcount != ((HEADER*)buf2)->qdcount)
return (0);
+
+ qdcount = htons (qdcount);
+ const u_char *cp = buf1 + HFIXEDSZ;
+
while (qdcount-- > 0) {
char tname[MAXDNAME+1];
int n, ttype, tclass;
@@ -318,8 +323,8 @@ res_queriesmatch(const u_char *buf1, const u_char *eom1,
cp += n;
if (cp + 2 * INT16SZ > eom1)
return (-1);
- ttype = ns_get16(cp); cp += INT16SZ;
- tclass = ns_get16(cp); cp += INT16SZ;
+ NS_GET16(ttype, cp);
+ NS_GET16(tclass, cp);
if (!res_nameinquery(tname, ttype, tclass, buf2, eom2))
return (0);
}
@@ -669,7 +674,7 @@ send_vc(res_state statp,
/*
* Send length & message
*/
- putshort((u_short)buflen, (u_char*)&len);
+ ns_put16((u_short)buflen, (u_char*)&len);
evConsIovec(&len, INT16SZ, &iov[0]);
evConsIovec((void*)buf, buflen, &iov[1]);
if (TEMP_FAILURE_RETRY (writev(statp->_vcsock, iov, 2))
@@ -874,9 +879,12 @@ send_dg(res_state statp,
pfd[0].events = POLLOUT;
wait:
if (need_recompute) {
+ recompute_resend:
evNowTime(&now);
if (evCmpTime(finish, now) <= 0) {
- Perror(statp, stderr, "select", errno);
+ poll_err_out:
+ Perror(statp, stderr, "poll", errno);
+ err_out:
__res_iclose(statp, false);
return (0);
}
@@ -899,26 +907,18 @@ send_dg(res_state statp,
return (0);
}
if (n < 0) {
- if (errno == EINTR) {
- recompute_resend:
- evNowTime(&now);
- if (evCmpTime(finish, now) > 0) {
- evSubTime(&timeout, &finish, &now);
- goto wait;
- }
- }
- Perror(statp, stderr, "poll", errno);
- __res_iclose(statp, false);
- return (0);
+ if (errno == EINTR)
+ goto recompute_resend;
+
+ goto poll_err_out;
}
__set_errno (0);
if (pfd[0].revents & POLLOUT) {
- if (send(pfd[0].fd, (char*)buf, buflen, 0) != buflen) {
+ if (send (pfd[0].fd, buf, buflen, MSG_NOSIGNAL) != buflen) {
if (errno == EINTR || errno == EAGAIN)
goto recompute_resend;
Perror(statp, stderr, "send", errno);
- __res_iclose(statp, false);
- return (0);
+ goto err_out;
}
pfd[0].events = POLLIN;
++nwritten;
@@ -948,8 +948,7 @@ send_dg(res_state statp,
goto wait;
}
Perror(statp, stderr, "recvfrom", errno);
- __res_iclose(statp, false);
- return (0);
+ goto err_out;
}
*gotsomewhere = 1;
if (resplen < HFIXEDSZ) {
@@ -960,8 +959,7 @@ send_dg(res_state statp,
(stdout, ";; undersized: %d\n",
resplen));
*terrno = EMSGSIZE;
- __res_iclose(statp, false);
- return (0);
+ goto err_out;
}
if (hp->id != anhp->id) {
/*
@@ -1039,8 +1037,7 @@ send_dg(res_state statp,
return (resplen);
} else if (pfd[0].revents & (POLLERR | POLLHUP | POLLNVAL)) {
/* Something went wrong. We can stop trying. */
- __res_iclose(statp, false);
- return (0);
+ goto err_out;
}
else {
/* poll should not have returned > 0 in this case. */
diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
index 4dd7768431..1ea9bc4e07 100644
--- a/stdio-common/vfscanf.c
+++ b/stdio-common/vfscanf.c
@@ -145,11 +145,6 @@
if (done == 0) done = EOF; \
goto errout; \
} while (0)
-#define memory_error() do { \
- __set_errno (ENOMEM); \
- done = EOF; \
- goto errout; \
- } while (0)
#define ARGCHECK(s, format) \
do \
{ \
@@ -355,7 +350,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
do
{
c = inchar ();
- if (c == EOF)
+ if (__builtin_expect (c == EOF, 0))
input_error ();
else if (c != (unsigned char) *f++)
{
@@ -383,7 +378,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
c = inchar ();
/* Characters other than format specs must just match. */
- if (c == EOF)
+ if (__builtin_expect (c == EOF, 0))
input_error ();
/* We saw white space char as the last character in the format
@@ -391,12 +386,12 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
if (skip_space)
{
while (ISSPACE (c))
- if (inchar () == EOF)
+ if (__builtin_expect (inchar () == EOF, 0))
input_error ();
skip_space = 0;
}
- if (c != fc)
+ if (__builtin_expect (c != fc, 0))
{
ungetc (c, s);
conv_error ();
@@ -532,7 +527,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
}
/* End of the format string? */
- if (*f == L_('\0'))
+ if (__builtin_expect (*f == L_('\0'), 0))
conv_error ();
/* Find the conversion specifier. */
@@ -544,7 +539,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
int save_errno = errno;
errno = 0;
do
- if (inchar () == EOF && errno == EINTR)
+ if (__builtin_expect (inchar () == EOF && errno == EINTR, 0))
input_error ();
while (ISSPACE (c));
errno = save_errno;
@@ -556,9 +551,9 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
{
case L_('%'): /* Must match a literal '%'. */
c = inchar ();
- if (c == EOF)
+ if (__builtin_expect (c == EOF, 0))
input_error ();
- if (c != fc)
+ if (__builtin_expect (c != fc, 0))
{
ungetc_not_eof (c, s);
conv_error ();
@@ -624,7 +619,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
}
c = inchar ();
- if (c == EOF)
+ if (__builtin_expect (c == EOF, 0))
input_error ();
if (width == -1)
@@ -640,7 +635,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
size_t n;
n = __wcrtomb (!(flags & SUPPRESS) ? str : NULL, c, &state);
- if (n == (size_t) -1)
+ if (__builtin_expect (n == (size_t) -1, 0))
/* No valid wide character. */
input_error ();
@@ -675,7 +670,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
}
c = inchar ();
- if (c == EOF)
+ if (__builtin_expect (c == EOF, 0))
input_error ();
#ifdef COMPILE_WSCANF
@@ -713,14 +708,14 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
{
/* Possibly correct character, just not enough
input. */
- if (inchar () == EOF)
+ if (__builtin_expect (inchar () == EOF, 0))
encode_error ();
buf[0] = c;
continue;
}
- if (n != 1)
+ if (__builtin_expect (n != 1, 0))
encode_error ();
/* We have a match. */
@@ -764,7 +759,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
STRING_ARG (str, char);
c = inchar ();
- if (c == EOF)
+ if (__builtin_expect (c == EOF, 0))
input_error ();
#ifdef COMPILE_WSCANF
@@ -827,7 +822,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
n = __wcrtomb (!(flags & SUPPRESS) ? str : NULL, c,
&state);
- if (n == (size_t) -1)
+ if (__builtin_expect (n == (size_t) -1, 0))
encode_error ();
assert (n <= MB_CUR_MAX);
@@ -935,7 +930,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
STRING_ARG (wstr, wchar_t);
c = inchar ();
- if (c == EOF)
+ if (__builtin_expect (c == EOF, 0))
input_error ();
#ifndef COMPILE_WSCANF
@@ -1010,14 +1005,14 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
{
/* Possibly correct character, just not enough
input. */
- if (inchar () == EOF)
+ if (__builtin_expect (inchar () == EOF, 0))
encode_error ();
buf[0] = c;
continue;
}
- if (n != 1)
+ if (__builtin_expect (n != 1, 0))
encode_error ();
/* We have a match. */
@@ -1112,7 +1107,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
number:
c = inchar ();
- if (c == EOF)
+ if (__builtin_expect (c == EOF, 0))
input_error ();
/* Check for a sign. */
@@ -1151,7 +1146,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
if (base == 0)
base = 10;
- if (base == 10 && (flags & I18N) != 0)
+ if (base == 10 && __builtin_expect ((flags & I18N) != 0, 0))
{
int from_level;
int to_level;
@@ -1511,12 +1506,14 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
{
/* There was no number. If we are supposed to read a pointer
we must recognize "(nil)" as well. */
- if (wpsize == 0 && read_pointer && (width < 0 || width >= 0)
- && c == '('
- && TOLOWER (inchar ()) == L_('n')
- && TOLOWER (inchar ()) == L_('i')
- && TOLOWER (inchar ()) == L_('l')
- && inchar () == L_(')'))
+ if (__builtin_expect (wpsize == 0
+ && read_pointer
+ && (width < 0 || width >= 0)
+ && c == '('
+ && TOLOWER (inchar ()) == L_('n')
+ && TOLOWER (inchar ()) == L_('i')
+ && TOLOWER (inchar ()) == L_('l')
+ && inchar () == L_(')'), 1))
/* We must produce the value of a NULL pointer. A single
'0' digit is enough. */
ADDW (L_('0'));
@@ -1549,7 +1546,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
else
num.ul = __strtoul_internal (wp, &tw, base, flags & GROUP);
}
- if (wp == tw)
+ if (__builtin_expect (wp == tw, 0))
conv_error ();
if (!(flags & SUPPRESS))
@@ -1594,7 +1591,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
case L_('a'):
case L_('A'):
c = inchar ();
- if (c == EOF)
+ if (__builtin_expect (c == EOF, 0))
input_error ();
got_dot = got_e = 0;
@@ -1603,14 +1600,14 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
if (c == L_('-') || c == L_('+'))
{
negative = c == L_('-');
- if (width == 0 || inchar () == EOF)
+ if (__builtin_expect (width == 0 || inchar () == EOF, 0))
/* EOF is only an input error before we read any chars. */
conv_error ();
if (! ISDIGIT (c) && TOLOWER (c) != L_('i')
&& TOLOWER (c) != L_('n'))
{
#ifdef COMPILE_WSCANF
- if (c != decimal)
+ if (__builtin_expect (c != decimal, 0))
{
/* This is no valid number. */
ungetc (c, s);
@@ -1635,7 +1632,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
break;
}
- if (*cmpp != '\0')
+ if (__builtin_expect (*cmpp != '\0', 0))
{
/* This is no valid number. */
while (1)
@@ -1674,12 +1671,16 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
{
/* Maybe "nan". */
ADDW (c);
- if (width == 0 || inchar () == EOF || TOLOWER (c) != L_('a'))
+ if (__builtin_expect (width == 0
+ || inchar () == EOF
+ || TOLOWER (c) != L_('a'), 0))
conv_error ();
if (width > 0)
--width;
ADDW (c);
- if (width == 0 || inchar () == EOF || TOLOWER (c) != L_('n'))
+ if (__builtin_expect (width == 0
+ || inchar () == EOF
+ || TOLOWER (c) != L_('n'), 0))
conv_error ();
if (width > 0)
--width;
@@ -1691,12 +1692,16 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
{
/* Maybe "inf" or "infinity". */
ADDW (c);
- if (width == 0 || inchar () == EOF || TOLOWER (c) != L_('n'))
+ if (__builtin_expect (width == 0
+ || inchar () == EOF
+ || TOLOWER (c) != L_('n'), 0))
conv_error ();
if (width > 0)
--width;
ADDW (c);
- if (width == 0 || inchar () == EOF || TOLOWER (c) != L_('f'))
+ if (__builtin_expect (width == 0
+ || inchar () == EOF
+ || TOLOWER (c) != L_('f'), 0))
conv_error ();
if (width > 0)
--width;
@@ -1710,26 +1715,30 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
--width;
/* Now we have to read the rest as well. */
ADDW (c);
- if (width == 0 || inchar () == EOF
- || TOLOWER (c) != L_('n'))
+ if (__builtin_expect (width == 0
+ || inchar () == EOF
+ || TOLOWER (c) != L_('n'), 0))
conv_error ();
if (width > 0)
--width;
ADDW (c);
- if (width == 0 || inchar () == EOF
- || TOLOWER (c) != L_('i'))
+ if (__builtin_expect (width == 0
+ || inchar () == EOF
+ || TOLOWER (c) != L_('i'), 0))
conv_error ();
if (width > 0)
--width;
ADDW (c);
- if (width == 0 || inchar () == EOF
- || TOLOWER (c) != L_('t'))
+ if (__builtin_expect (width == 0
+ || inchar () == EOF
+ || TOLOWER (c) != L_('t'), 0))
conv_error ();
if (width > 0)
--width;
ADDW (c);
- if (width == 0 || inchar () == EOF
- || TOLOWER (c) != L_('y'))
+ if (__builtin_expect (width == 0
+ || inchar () == EOF
+ || TOLOWER (c) != L_('y'), 0))
conv_error ();
if (width > 0)
--width;
@@ -1880,7 +1889,8 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
/* Have we read any character? If we try to read a number
in hexadecimal notation and we have read only the `0x'
prefix or no exponent this is an error. */
- if (wpsize == 0 || (is_hexa && (wpsize == 2 || ! got_e)))
+ if (__builtin_expect (wpsize == 0
+ || (is_hexa && (wpsize == 2 || ! got_e)), 0))
conv_error ();
scan_float:
@@ -1905,7 +1915,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
*ARG (float *) = negative ? -d : d;
}
- if (tw == wp)
+ if (__builtin_expect (tw == wp, 0))
conv_error ();
if (!(flags & SUPPRESS))
@@ -1945,7 +1955,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
while ((fc = *f++) != L'\0' && fc != L']');
- if (fc == L'\0')
+ if (__builtin_expect (fc == L'\0', 0))
conv_error ();
wp = (wchar_t *) f - 1;
#else
@@ -1981,7 +1991,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
/* Add the character to the flag map. */
wp[fc] = 1;
- if (fc == '\0')
+ if (__builtin_expect (fc == '\0', 0))
conv_error();
#endif
@@ -1989,7 +1999,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
{
size_t now = read_in;
#ifdef COMPILE_WSCANF
- if (inchar () == WEOF)
+ if (__builtin_expect (inchar () == WEOF, 0))
input_error ();
do
@@ -2094,7 +2104,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
size_t cnt = 0;
mbstate_t cstate;
- if (inchar () == EOF)
+ if (__builtin_expect (inchar () == EOF, 0))
input_error ();
memset (&cstate, '\0', sizeof (cstate));
@@ -2171,13 +2181,13 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
}
while (inchar () != EOF);
- if (cnt != 0)
+ if (__builtin_expect (cnt != 0, 0))
/* We stopped in the middle of recognizing another
character. That's a problem. */
encode_error ();
#endif
- if (now == read_in)
+ if (__builtin_expect (now == read_in, 0))
/* We haven't succesfully read any character. */
conv_error ();
@@ -2202,7 +2212,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
{
size_t now = read_in;
- if (inchar () == EOF)
+ if (__builtin_expect (inchar () == EOF, 0))
input_error ();
#ifdef COMPILE_WSCANF
@@ -2304,7 +2314,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
}
n = __wcrtomb (!(flags & SUPPRESS) ? str : NULL, c, &state);
- if (n == (size_t) -1)
+ if (__builtin_expect (n == (size_t) -1, 0))
encode_error ();
assert (n <= MB_CUR_MAX);
@@ -2361,7 +2371,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
while (--width > 0 && inchar () != EOF);
#endif
- if (now == read_in)
+ if (__builtin_expect (now == read_in, 0))
/* We haven't succesfully read any character. */
conv_error ();
diff --git a/stdlib/canonicalize.c b/stdlib/canonicalize.c
index 9fc24b7d92..19808b50d6 100644
--- a/stdlib/canonicalize.c
+++ b/stdlib/canonicalize.c
@@ -1,5 +1,5 @@
/* Return the canonical absolute name of a given file.
- Copyright (C) 1996-2002, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1996-2002, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -91,7 +91,7 @@ __realpath (const char *name, char *resolved)
rpath[0] = '\0';
goto error;
}
- dest = strchr (rpath, '\0');
+ dest = __rawmemchr (rpath, '\0');
}
else
{
diff --git a/string/argz-replace.c b/string/argz-replace.c
index 3c4062488e..1b0eb15fd7 100644
--- a/string/argz-replace.c
+++ b/string/argz-replace.c
@@ -1,5 +1,5 @@
/* String replacement in an argz vector
- Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -121,8 +121,7 @@ __argz_replace (char **argz, size_t *argz_len, const char *str, const char *with
if (! delayed_copy)
/* We never found any instances of str. */
{
- if (src)
- free (src);
+ free (src);
*argz = dst;
*argz_len = dst_len;
}
diff --git a/sunrpc/des_impl.c b/sunrpc/des_impl.c
index d0004b97f1..dc94e221ab 100644
--- a/sunrpc/des_impl.c
+++ b/sunrpc/des_impl.c
@@ -6,10 +6,11 @@
/* write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,*/
/* Boston, MA 02111, USA to obtain a copy. */
#include <string.h>
+#include <stdint.h>
#include "des.h"
-static const unsigned long des_SPtrans[8][64] =
+static const uint32_t des_SPtrans[8][64] =
{
{ /* nibble 0 */
0x00820200, 0x00020000, 0x80800000, 0x80820200,
@@ -155,7 +156,7 @@ static const unsigned long des_SPtrans[8][64] =
0x00000020, 0x08208000, 0x00208020, 0x00000000,
0x08000000, 0x08200020, 0x00008000, 0x00208020}};
-static const unsigned long des_skb[8][64] =
+static const uint32_t des_skb[8][64] =
{
{ /* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */
0x00000000, 0x00000010, 0x20000000, 0x20000010,
@@ -352,26 +353,6 @@ static const unsigned long des_skb[8][64] =
(a)=(a)^(t)^(t>>(16-(n))))
-/* The changes to this macro may help or hinder, depending on the
- * compiler and the achitecture. gcc2 always seems to do well :-).
- * Inspired by Dana How <how@isl.stanford.edu>
- * DO NOT use the alternative version on machines with 8 byte longs.
- */
-#ifdef ALT_ECB
-#define D_ENCRYPT(L,R,S) \
- u=((R^s[S ])<<2); \
- t= R^s[S+1]; \
- t=((t>>2)+(t<<30)); \
- L^= \
- *(const unsigned long *)(des_SP+0x0100+((t )&0xfc))+ \
- *(const unsigned long *)(des_SP+0x0300+((t>> 8)&0xfc))+ \
- *(const unsigned long *)(des_SP+0x0500+((t>>16)&0xfc))+ \
- *(const unsigned long *)(des_SP+0x0700+((t>>24)&0xfc))+ \
- *(const unsigned long *)(des_SP+ ((u )&0xfc))+ \
- *(const unsigned long *)(des_SP+0x0200+((u>> 8)&0xfc))+ \
- *(const unsigned long *)(des_SP+0x0400+((u>>16)&0xfc))+ \
- *(const unsigned long *)(des_SP+0x0600+((u>>24)&0xfc));
-#else /* original version */
#define D_ENCRYPT(L,R,S) \
u=(R^s[S ]); \
t=R^s[S+1]; \
@@ -384,7 +365,6 @@ static const unsigned long des_skb[8][64] =
des_SPtrans[2][(u>> 8)&0x3f]| \
des_SPtrans[4][(u>>16)&0x3f]| \
des_SPtrans[6][(u>>24)&0x3f];
-#endif
#define ITERATIONS 16
@@ -464,9 +444,6 @@ internal_function
des_encrypt (unsigned long *buf, unsigned long *schedule, int encrypt)
{
register unsigned long l, r, t, u;
-#ifdef ALT_ECB
- register const unsigned char *des_SP = (const unsigned char *) des_SPtrans;
-#endif
register int i;
register unsigned long *s;
diff --git a/sunrpc/svc_udp.c b/sunrpc/svc_udp.c
index 67b84f184f..dfeb6de70f 100644
--- a/sunrpc/svc_udp.c
+++ b/sunrpc/svc_udp.c
@@ -406,8 +406,8 @@ svcudp_destroy (xprt)
#define ALLOC(type, size) \
(type *) mem_alloc((unsigned) (sizeof(type) * (size)))
-#define BZERO(addr, type, size) \
- __bzero((char *) addr, sizeof(type) * (int) (size))
+#define CALLOC(type, size) \
+ (type *) calloc (sizeof (type), size)
/*
* An entry in the cache
@@ -482,15 +482,14 @@ svcudp_enablecache (SVCXPRT *transp, u_long size)
}
uc->uc_size = size;
uc->uc_nextvictim = 0;
- uc->uc_entries = ALLOC (cache_ptr, size * SPARSENESS);
+ uc->uc_entries = CALLOC (cache_ptr, size * SPARSENESS);
if (uc->uc_entries == NULL)
{
mem_free (uc, sizeof (struct udp_cache));
CACHE_PERROR (_("enablecache: could not allocate cache data"));
return 0;
}
- BZERO (uc->uc_entries, cache_ptr, size * SPARSENESS);
- uc->uc_fifo = ALLOC (cache_ptr, size);
+ uc->uc_fifo = CALLOC (cache_ptr, size);
if (uc->uc_fifo == NULL)
{
mem_free (uc->uc_entries, size * SPARSENESS);
@@ -498,7 +497,6 @@ svcudp_enablecache (SVCXPRT *transp, u_long size)
CACHE_PERROR (_("enablecache: could not allocate cache fifo"));
return 0;
}
- BZERO (uc->uc_fifo, cache_ptr, size);
su->su_cache = (char *) uc;
return 1;
}
diff --git a/sunrpc/svcauth_des.c b/sunrpc/svcauth_des.c
index becdd5066d..933d001341 100644
--- a/sunrpc/svcauth_des.c
+++ b/sunrpc/svcauth_des.c
@@ -396,11 +396,9 @@ cache_init (void)
register int i;
authdes_cache = (struct cache_entry *)
- mem_alloc (sizeof (struct cache_entry) * AUTHDES_CACHESZ);
+ calloc (sizeof (struct cache_entry) * AUTHDES_CACHESZ, 1);
if (authdes_cache == NULL)
return;
- __bzero ((char *) authdes_cache,
- sizeof (struct cache_entry) * AUTHDES_CACHESZ);
authdes_lru = (int *) mem_alloc (sizeof (int) * AUTHDES_CACHESZ);
/*
diff --git a/sunrpc/xdr_ref.c b/sunrpc/xdr_ref.c
index 961c82edd2..bc5f72d6a6 100644
--- a/sunrpc/xdr_ref.c
+++ b/sunrpc/xdr_ref.c
@@ -79,14 +79,13 @@ xdr_reference (xdrs, pp, size, proc)
return TRUE;
case XDR_DECODE:
- *pp = loc = (caddr_t) mem_alloc (size);
+ *pp = loc = (caddr_t) calloc (1, size);
if (loc == NULL)
{
(void) __fxprintf (NULL, "%s",
_("xdr_reference: out of memory\n"));
return FALSE;
}
- __bzero (loc, (int) size);
break;
default:
break;
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 13fefd9e83..6d817651c9 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -1,5 +1,5 @@
/* Run-time dynamic linker data structures for loaded ELF shared objects.
- Copyright (C) 1995-2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1995-2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -193,8 +193,6 @@ struct La_ppc64_regs;
struct La_ppc64_retval;
struct La_sh_regs;
struct La_sh_retval;
-struct La_m68k_regs;
-struct La_m68k_retval;
struct La_alpha_regs;
struct La_alpha_retval;
struct La_s390_32_regs;
@@ -203,10 +201,6 @@ struct La_s390_64_regs;
struct La_s390_64_retval;
struct La_ia64_regs;
struct La_ia64_retval;
-struct La_mips_32_regs;
-struct La_mips_32_retval;
-struct La_mips_64_regs;
-struct La_mips_64_retval;
struct La_sparc32_regs;
struct La_sparc32_retval;
struct La_sparc64_regs;
@@ -247,10 +241,6 @@ struct audit_ifaces
uintptr_t *, const struct La_sh_regs *,
unsigned int *, const char *name,
long int *framesizep);
- Elf32_Addr (*m68k_gnu_pltenter) (Elf32_Sym *, unsigned int, uintptr_t *,
- uintptr_t *, struct La_m68k_regs *,
- unsigned int *, const char *name,
- long int *framesizep);
Elf64_Addr (*alpha_gnu_pltenter) (Elf64_Sym *, unsigned int, uintptr_t *,
uintptr_t *, struct La_alpha_regs *,
unsigned int *, const char *name,
@@ -267,21 +257,6 @@ struct audit_ifaces
uintptr_t *, struct La_ia64_regs *,
unsigned int *, const char *name,
long int *framesizep);
- Elf32_Addr (*mips_o32_gnu_pltenter) (Elf32_Sym *, unsigned int,
- uintptr_t *, uintptr_t *,
- const struct La_mips_32_regs *,
- unsigned int *, const char *name,
- long int *framesizep);
- Elf32_Addr (*mips_n32_gnu_pltenter) (Elf32_Sym *, unsigned int,
- uintptr_t *, uintptr_t *,
- const struct La_mips_64_regs *,
- unsigned int *, const char *name,
- long int *framesizep);
- Elf64_Addr (*mips_n64_gnu_pltenter) (Elf64_Sym *, unsigned int,
- uintptr_t *, uintptr_t *,
- const struct La_mips_64_regs *,
- unsigned int *, const char *name,
- long int *framesizep);
Elf32_Addr (*sparc32_gnu_pltenter) (Elf32_Sym *, unsigned int,
uintptr_t *, uintptr_t *,
const struct La_sparc32_regs *,
@@ -317,9 +292,6 @@ struct audit_ifaces
unsigned int (*sh_gnu_pltexit) (Elf32_Sym *, unsigned int, uintptr_t *,
uintptr_t *, const struct La_sh_regs *,
struct La_sh_retval *, const char *);
- unsigned int (*m68k_gnu_pltexit) (Elf32_Sym *, unsigned int, uintptr_t *,
- uintptr_t *, const struct La_m68k_regs *,
- struct La_m68k_retval *, const char *);
unsigned int (*alpha_gnu_pltexit) (Elf64_Sym *, unsigned int, uintptr_t *,
uintptr_t *,
const struct La_alpha_regs *,
@@ -338,21 +310,6 @@ struct audit_ifaces
uintptr_t *,
const struct La_ia64_regs *,
struct La_ia64_retval *, const char *);
- unsigned int (*mips_o32_gnu_pltexit) (Elf32_Sym *, unsigned int,
- uintptr_t *, uintptr_t *,
- const struct La_mips_32_regs *,
- struct La_mips_32_retval *,
- const char *);
- unsigned int (*mips_n32_gnu_pltexit) (Elf32_Sym *, unsigned int,
- uintptr_t *, uintptr_t *,
- const struct La_mips_64_regs *,
- struct La_mips_64_retval *,
- const char *);
- unsigned int (*mips_n64_gnu_pltexit) (Elf64_Sym *, unsigned int,
- uintptr_t *, uintptr_t *,
- const struct La_mips_64_regs *,
- struct La_mips_64_retval *,
- const char *);
unsigned int (*sparc32_gnu_pltexit) (Elf32_Sym *, unsigned int,
uintptr_t *, uintptr_t *,
const struct La_sparc32_regs *,
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index fc0928676d..a78c670bfb 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -1047,7 +1047,10 @@ gaih_inet (const char *name, const struct gaih_service *service,
struct addrinfo *ai;
ai = *pai = malloc (sizeof (struct addrinfo) + socklen);
if (ai == NULL)
- return -EAI_MEMORY;
+ {
+ free ((char *) canon);
+ return -EAI_MEMORY;
+ }
ai->ai_flags = req->ai_flags;
ai->ai_family = family;
@@ -1065,6 +1068,10 @@ gaih_inet (const char *name, const struct gaih_service *service,
#endif /* _HAVE_SA_LEN */
ai->ai_addr->sa_family = family;
+ /* In case of an allocation error the list must be NULL
+ terminated. */
+ ai->ai_next = NULL;
+
if (family == AF_INET6)
{
struct sockaddr_in6 *sin6p =
@@ -1088,7 +1095,6 @@ gaih_inet (const char *name, const struct gaih_service *service,
pai = &(ai->ai_next);
}
- *pai = NULL;
++*naddrs;
diff --git a/sysdeps/s390/s390-32/elf/start.S b/sysdeps/s390/s390-32/elf/start.S
index a09acb5d89..f7290106ce 100644
--- a/sysdeps/s390/s390-32/elf/start.S
+++ b/sysdeps/s390/s390-32/elf/start.S
@@ -1,5 +1,6 @@
/* Startup code compliant to the ELF s390 ABI.
- Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006
+ Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of the GNU C Library.
@@ -88,9 +89,9 @@ _start:
l %r12,.L5-.Llit(%r13) # load .got pointer
la %r6,0(%r13,%r6)
la %r5,0(%r13,%r5)
- la %r2,0(%r13,%r2)
- la %r1,0(%r13,%r1)
la %r12,0(%r13,%r12)
+ l %r2,0(%r12,%r2)
+ la %r1,0(%r13,%r1)
#endif
/* ok, now branch to the libc main routine */
@@ -108,7 +109,7 @@ _start:
#else
.L1: .long __libc_csu_init-.Llit
.L2: .long __libc_csu_fini-.Llit
-.L3: .long main-.Llit
+.L3: .long main@GOT
.L4: .long __libc_start_main@plt-.Llit
.L5: .long _GLOBAL_OFFSET_TABLE_-.Llit
#endif
diff --git a/sysdeps/s390/s390-64/elf/start.S b/sysdeps/s390/s390-64/elf/start.S
index e5013d0057..c4cb34d02c 100644
--- a/sysdeps/s390/s390-64/elf/start.S
+++ b/sysdeps/s390/s390-64/elf/start.S
@@ -1,5 +1,5 @@
/* Startup code compliant to the 64 bit S/390 ELF ABI.
- Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of the GNU C Library.
@@ -78,12 +78,14 @@ _start:
la %r7,160(%r15)
larl %r6,__libc_csu_fini # load pointer to __libc_csu_fini
larl %r5,__libc_csu_init # load pointer to __libc_csu_init
- larl %r2,main # load pointer to main
/* Ok, now branch to the libc main routine. */
#ifdef PIC
+ larl %r2,main@GOTENT # load pointer to main
+ lg %r2,0(%r2)
brasl %r14,__libc_start_main@plt
#else
+ larl %r2,main # load pointer to main
brasl %r14,__libc_start_main
#endif
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h b/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
index 4a20f1d673..9b2e635d60 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
@@ -177,6 +177,7 @@ struct flock64
#ifdef __USE_GNU
+/* Flags for SYNC_FILE_RANGE. */
# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
in the range before performing the
write. */
@@ -186,6 +187,14 @@ struct flock64
# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
the range after performing the
write. */
+
+/* Flags for SPLICE and VMSPLICE. */
+# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
+# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
+ (but we may still block on the fd
+ we splice from/to). */
+# define SPLICE_F_MORE 4 /* Expect more data. */
+# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
#endif
__BEGIN_DECLS
diff --git a/sysdeps/unix/sysv/linux/check_pf.c b/sysdeps/unix/sysv/linux/check_pf.c
index f186182cf6..7fbb7543d6 100644
--- a/sysdeps/unix/sysv/linux/check_pf.c
+++ b/sysdeps/unix/sysv/linux/check_pf.c
@@ -17,9 +17,11 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <assert.h>
#include <errno.h>
#include <ifaddrs.h>
#include <netdb.h>
+#include <stddef.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
@@ -42,10 +44,14 @@ static int
make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6,
struct in6addrinfo **in6ai, size_t *in6ailen)
{
- struct
+ struct req
{
struct nlmsghdr nlh;
struct rtgenmsg g;
+ /* struct rtgenmsg consists of a single byte. This means there
+ are three bytes of padding included in the REQ definition.
+ We make them explicit here. */
+ char pad[3];
} req;
struct sockaddr_nl nladdr;
@@ -56,6 +62,9 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6,
req.nlh.nlmsg_seq = time (NULL);
req.g.rtgen_family = AF_UNSPEC;
+ assert (sizeof (req) - offsetof (struct req, pad) == 3);
+ memset (req.pad, '\0', sizeof (req.pad));
+
memset (&nladdr, '\0', sizeof (nladdr));
nladdr.nl_family = AF_NETLINK;
diff --git a/sysdeps/unix/sysv/linux/i386/bits/fcntl.h b/sysdeps/unix/sysv/linux/i386/bits/fcntl.h
index 82f06332be..81d9932675 100644
--- a/sysdeps/unix/sysv/linux/i386/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/i386/bits/fcntl.h
@@ -185,6 +185,7 @@ struct flock64
#ifdef __USE_GNU
+/* Flags for SYNC_FILE_RANGE. */
# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
in the range before performing the
write. */
@@ -194,6 +195,14 @@ struct flock64
# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
the range after performing the
write. */
+
+/* Flags for SPLICE and VMSPLICE. */
+# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
+# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
+ (but we may still block on the fd
+ we splice from/to). */
+# define SPLICE_F_MORE 4 /* Expect more data. */
+# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
#endif
__BEGIN_DECLS
diff --git a/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h b/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h
index 1d684ad367..4695d92618 100644
--- a/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h
@@ -179,6 +179,7 @@ struct flock64
#ifdef __USE_GNU
+/* Flags for SYNC_FILE_RANGE. */
# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
in the range before performing the
write. */
@@ -188,6 +189,14 @@ struct flock64
# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
the range after performing the
write. */
+
+/* Flags for SPLICE and VMSPLICE. */
+# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
+# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
+ (but we may still block on the fd
+ we splice from/to). */
+# define SPLICE_F_MORE 4 /* Expect more data. */
+# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
#endif
__BEGIN_DECLS
diff --git a/sysdeps/unix/sysv/linux/ifaddrs.c b/sysdeps/unix/sysv/linux/ifaddrs.c
index f743f702f0..e6720f0ca2 100644
--- a/sysdeps/unix/sysv/linux/ifaddrs.c
+++ b/sysdeps/unix/sysv/linux/ifaddrs.c
@@ -1,5 +1,5 @@
/* getifaddrs -- get names and addresses of all network interfaces
- Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -358,8 +358,7 @@ getifaddrs (struct ifaddrs **ifap)
ifa_data. */
int result = 0;
- if (ifap)
- *ifap = NULL;
+ *ifap = NULL;
if (! __no_netlink_support && __netlink_open (&nh) < 0)
{
@@ -840,8 +839,7 @@ getifaddrs (struct ifaddrs **ifap)
memmove (ifas, &ifas[newlink], sizeof (struct ifaddrs_storage));
}
- if (ifap != NULL)
- *ifap = &ifas[0].ifa;
+ *ifap = &ifas[0].ifa;
exit_free:
__netlink_free_handle (&nh);
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h b/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
index 2843c6e9cc..5d6bb6fe44 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
@@ -185,6 +185,7 @@ struct flock64
#ifdef __USE_GNU
+/* Flags for SYNC_FILE_RANGE. */
# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
in the range before performing the
write. */
@@ -194,6 +195,14 @@ struct flock64
# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
the range after performing the
write. */
+
+/* Flags for SPLICE and VMSPLICE. */
+# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
+# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
+ (but we may still block on the fd
+ we splice from/to). */
+# define SPLICE_F_MORE 4 /* Expect more data. */
+# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
#endif
__BEGIN_DECLS
diff --git a/sysdeps/unix/sysv/linux/s390/bits/fcntl.h b/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
index 7a9aa5738e..166bae59bf 100644
--- a/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
@@ -205,6 +205,7 @@ struct flock64
#ifdef __USE_GNU
+/* Flags for SYNC_FILE_RANGE. */
# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
in the range before performing the
write. */
@@ -214,6 +215,14 @@ struct flock64
# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
the range after performing the
write. */
+
+/* Flags for SPLICE and VMSPLICE. */
+# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
+# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
+ (but we may still block on the fd
+ we splice from/to). */
+# define SPLICE_F_MORE 4 /* Expect more data. */
+# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
#endif
__BEGIN_DECLS
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S b/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S
index d1ce925ac3..b7e1736891 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of the GNU C Library.
@@ -48,13 +48,14 @@ ENTRY (syscall)
lr %r4,%r5 /* third parameter */
lr %r5,%r6 /* fourth parameter */
l %r6,192(%r15) /* fifth parameter */
+ l %r7,196(%r15) /* sixth parameter */
- basr %r7,0
-0: cl %r1,4f-0b(%r7) /* svc number < 256? */
+ basr %r8,0
+0: cl %r1,4f-0b(%r8) /* svc number < 256? */
jl 2f
1: svc 0
j 3f
-2: ex %r1,1b-0b(%r7) /* lsb of R1 is subsituted as SVC number */
+2: ex %r1,1b-0b(%r8) /* lsb of R1 is subsituted as SVC number */
3: l %r15,0(%r15) /* load back chain */
cfi_adjust_cfa_offset (-96)
lm %r6,15,24(%r15) /* load registers */
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscall.S b/sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
index 4caeaeaf50..31b55d73f2 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2006 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of the GNU C Library.
@@ -48,13 +48,14 @@ ENTRY (syscall)
lgr %r4,%r5 /* Third parameter. */
lgr %r5,%r6 /* Fourth parameter. */
lg %r6,320(%r15) /* Fifth parameter. */
+ lg %r7,328(%r15) /* Sixth parameter. */
- basr %r7,0
-0: clg %r1,4f-0b(%r7) /* svc number < 256? */
+ basr %r8,0
+0: clg %r1,4f-0b(%r8) /* svc number < 256? */
jl 2f
1: svc 0
j 3f
-2: ex %r1,1b-0b(%r7) /* lsb of R1 is subsituted as SVC number */
+2: ex %r1,1b-0b(%r8) /* lsb of R1 is subsituted as SVC number */
3: lg %r15,0(%r15) /* load back chain */
cfi_adjust_cfa_offset (-160)
lmg %r6,15,48(%r15) /* Load registers. */
diff --git a/sysdeps/unix/sysv/linux/sh/bits/fcntl.h b/sysdeps/unix/sysv/linux/sh/bits/fcntl.h
index 82f06332be..81d9932675 100644
--- a/sysdeps/unix/sysv/linux/sh/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/sh/bits/fcntl.h
@@ -185,6 +185,7 @@ struct flock64
#ifdef __USE_GNU
+/* Flags for SYNC_FILE_RANGE. */
# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
in the range before performing the
write. */
@@ -194,6 +195,14 @@ struct flock64
# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
the range after performing the
write. */
+
+/* Flags for SPLICE and VMSPLICE. */
+# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
+# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
+ (but we may still block on the fd
+ we splice from/to). */
+# define SPLICE_F_MORE 4 /* Expect more data. */
+# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
#endif
__BEGIN_DECLS
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h b/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
index e8cc3987e3..022f24ac17 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
@@ -204,6 +204,7 @@ struct flock64
#ifdef __USE_GNU
+/* Flags for SYNC_FILE_RANGE. */
# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
in the range before performing the
write. */
@@ -213,6 +214,14 @@ struct flock64
# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
the range after performing the
write. */
+
+/* Flags for SPLICE and VMSPLICE. */
+# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
+# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
+ (but we may still block on the fd
+ we splice from/to). */
+# define SPLICE_F_MORE 4 /* Expect more data. */
+# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
#endif
__BEGIN_DECLS
diff --git a/sysdeps/unix/sysv/linux/tcgetattr.c b/sysdeps/unix/sysv/linux/tcgetattr.c
index 63453ca031..28e3e535ba 100644
--- a/sysdeps/unix/sysv/linux/tcgetattr.c
+++ b/sysdeps/unix/sysv/linux/tcgetattr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995, 1997, 1998, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1992,1995,1997,1998,2003,2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -40,39 +40,40 @@ __tcgetattr (fd, termios_p)
retval = INLINE_SYSCALL (ioctl, 3, fd, TCGETS, &k_termios);
- termios_p->c_iflag = k_termios.c_iflag;
- termios_p->c_oflag = k_termios.c_oflag;
- termios_p->c_cflag = k_termios.c_cflag;
- termios_p->c_lflag = k_termios.c_lflag;
- termios_p->c_line = k_termios.c_line;
+ if (__builtin_expect (retval == 0, 1))
+ {
+ termios_p->c_iflag = k_termios.c_iflag;
+ termios_p->c_oflag = k_termios.c_oflag;
+ termios_p->c_cflag = k_termios.c_cflag;
+ termios_p->c_lflag = k_termios.c_lflag;
+ termios_p->c_line = k_termios.c_line;
#ifdef _HAVE_STRUCT_TERMIOS_C_ISPEED
# ifdef _HAVE_C_ISPEED
- termios_p->c_ispeed = k_termios.c_ispeed;
+ termios_p->c_ispeed = k_termios.c_ispeed;
# else
- termios_p->c_ispeed = k_termios.c_cflag & (CBAUD | CBAUDEX);
+ termios_p->c_ispeed = k_termios.c_cflag & (CBAUD | CBAUDEX);
# endif
#endif
#ifdef _HAVE_STRUCT_TERMIOS_C_OSPEED
# ifdef _HAVE_C_OSPEED
- termios_p->c_ospeed = k_termios.c_ospeed;
+ termios_p->c_ospeed = k_termios.c_ospeed;
# else
- termios_p->c_ospeed = k_termios.c_cflag & (CBAUD | CBAUDEX);
+ termios_p->c_ospeed = k_termios.c_cflag & (CBAUD | CBAUDEX);
# endif
#endif
- if (sizeof (cc_t) == 1 || _POSIX_VDISABLE == 0
- || (unsigned char) _POSIX_VDISABLE == (unsigned char) -1)
- memset (__mempcpy (&termios_p->c_cc[0], &k_termios.c_cc[0],
- __KERNEL_NCCS * sizeof (cc_t)),
- _POSIX_VDISABLE, (NCCS - __KERNEL_NCCS) * sizeof (cc_t));
- else
- {
- size_t cnt;
-
- memcpy (&termios_p->c_cc[0], &k_termios.c_cc[0],
- __KERNEL_NCCS * sizeof (cc_t));
+ if (sizeof (cc_t) == 1 || _POSIX_VDISABLE == 0
+ || (unsigned char) _POSIX_VDISABLE == (unsigned char) -1)
+ memset (__mempcpy (&termios_p->c_cc[0], &k_termios.c_cc[0],
+ __KERNEL_NCCS * sizeof (cc_t)),
+ _POSIX_VDISABLE, (NCCS - __KERNEL_NCCS) * sizeof (cc_t));
+ else
+ {
+ memcpy (&termios_p->c_cc[0], &k_termios.c_cc[0],
+ __KERNEL_NCCS * sizeof (cc_t));
- for (cnt = __KERNEL_NCCS; cnt < NCCS; ++cnt)
- termios_p->c_cc[cnt] = _POSIX_VDISABLE;
+ for (size_t cnt = __KERNEL_NCCS; cnt < NCCS; ++cnt)
+ termios_p->c_cc[cnt] = _POSIX_VDISABLE;
+ }
}
return retval;
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h b/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
index ad4c1443e4..771de60711 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
@@ -199,6 +199,7 @@ struct flock64
#ifdef __USE_GNU
+/* Flags for SYNC_FILE_RANGE. */
# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
in the range before performing the
write. */
@@ -208,6 +209,14 @@ struct flock64
# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
the range after performing the
write. */
+
+/* Flags for SPLICE and VMSPLICE. */
+# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
+# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
+ (but we may still block on the fd
+ we splice from/to). */
+# define SPLICE_F_MORE 4 /* Expect more data. */
+# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
#endif
__BEGIN_DECLS