]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Updated to fedora-glibc-20060511T1325 cvs/fedora-glibc-2_4_90-7
authorJakub Jelinek <jakub@redhat.com>
Thu, 11 May 2006 14:01:43 +0000 (14:01 +0000)
committerJakub Jelinek <jakub@redhat.com>
Thu, 11 May 2006 14:01:43 +0000 (14:01 +0000)
56 files changed:
ChangeLog
NEWS
argp/Makefile
argp/argp-help.c
argp/bug-argp1.c [new file with mode: 0644]
elf/dl-dst.h
elf/dl-load.c
fedora/branch.mk
fedora/glibc.spec.in
iconv/iconv_charmap.c
include/arpa/nameser.h
io/ftw.c
locale/programs/ld-time.c
locale/programs/locfile.c
misc/sys/queue.h
nis/nis_creategroup.c
nis/nis_defaults.c
nis/nis_lookup.c
nis/nss-nis.h
nis/nss-nisplus.h
nis/nss_nis/nis-service.c
nptl/ChangeLog
nptl/pthread_atfork.c
nptl/sysdeps/pthread/unwind-forcedunwind.c
nptl/sysdeps/unix/sysv/linux/ia64/unwind-forcedunwind.c
nss/nsswitch.c
posix/getconf.c
posix/wordexp.c
resolv/nss_dns/dns-canon.c
resolv/res_mkquery.c
resolv/res_query.c
resolv/res_send.c
stdio-common/vfscanf.c
stdlib/canonicalize.c
string/argz-replace.c
sunrpc/des_impl.c
sunrpc/svc_udp.c
sunrpc/svcauth_des.c
sunrpc/xdr_ref.c
sysdeps/generic/ldsodefs.h
sysdeps/posix/getaddrinfo.c
sysdeps/s390/s390-32/elf/start.S
sysdeps/s390/s390-64/elf/start.S
sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
sysdeps/unix/sysv/linux/check_pf.c
sysdeps/unix/sysv/linux/i386/bits/fcntl.h
sysdeps/unix/sysv/linux/ia64/bits/fcntl.h
sysdeps/unix/sysv/linux/ifaddrs.c
sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
sysdeps/unix/sysv/linux/s390/bits/fcntl.h
sysdeps/unix/sysv/linux/s390/s390-32/syscall.S
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
sysdeps/unix/sysv/linux/sh/bits/fcntl.h
sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
sysdeps/unix/sysv/linux/tcgetattr.c
sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h

index 8c427ac75c07d1943793443b4cbf10be8d392654..92259aa5b475931882b0c0a4a25af69b64f16c4d 100644 (file)
--- 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 2a9ac22b657e50c197d101cc43cf168b06c3e543..006aa2989faa49dd9bff326e8386613ee1c14bba 100644 (file)
--- 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.
+
 \f
 Version 2.4
 
index a68ca1bee3d700a1f8a487381cc63ff944013540..5ade517476bdc39ecec364a6c12f077942d86303 100644 (file)
@@ -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
index 4bc4d07b1568de9da4bbab7b56ac6ad1df53bbbf..13c0820710d6173d835b290d1650ecfdbda9979a 100644 (file)
@@ -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 (file)
index 0000000..a28cf4b
--- /dev/null
@@ -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"
index 42bd4185afaea62a9441733aaf7a241f7a462917..83d16bdb0e090dcf75404111c00ceb018f409c50 100644 (file)
@@ -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');                                  \
                                                                              \
     __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)
index 29fdfd8f1948a5efa73c0b94a2dc494a51245430..01e1572f514479dbb65963a08922f8d5579efe8d 100644 (file)
@@ -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)
index 3c205c23690ea7d484d022bbc946299f155b5fc8..3f536bb857c225c81eaeaea0e0d45bd81ca2f61c 100644 (file)
@@ -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
index 4dd977451533b95c73b8203dcd4f214eb13bcbd1..bbdbce12845bf0b47e4e7775e32705602a2b6071 100644 (file)
@@ -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
index 328121edbe204c696521fab2894fa7a88e3a3de9..a54d7381202a479dd3bbbcfaa087c2c37571a02d 100644 (file)
@@ -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.  */
index 944fe732a6eab80759aace49c8ce78b7033b5ec5..449f5b452e2ab0b249e99a1e67fe973e2380dea3 100644 (file)
@@ -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
index e96076a20301097cb2a5e80a15c261151294b425..413871744eac8667ab1fe5bcb3a3c6bac3c98434 100644 (file)
--- 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] != '/')
index 2d63275d3cc059b4a9a4154f74c5350cac729dc9..78aff7fee6142bdfce43d66735d14b9407a66018 100644 (file)
@@ -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;
        }
     }
 
index bc12fbb332445185347ef96dcf5a881d5864b67e..ae8ce73ce48f2a67744c0bbca94718c4cc3ca905 100644 (file)
@@ -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;
 
index d709d48be59440c3623094b3bc59e8b615c1856b..b0e6b38c1904130fe34d7fa13feac7bce80cff03 100644 (file)
@@ -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)                               \
index a7808abf4bdf28867f28d8b52bbb4b68f29dc598..0e9e13d5e567b45481598eb92eb24b7925c8689e 100644 (file)
@@ -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)
index f13578635ab567c0cf9057d6c6328b091ba9b070..59fbbe4b26e06f33ab5e084942e4f2a04baf48cf 100644 (file)
@@ -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>
 ** 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)
 {
index 4cb34dd1a852e2d0cdf797ad09a688c12a583ac1..821b9bce73a080b4aaa4023022833f1a674417af 100644 (file)
@@ -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);
 
index 5ac968e28e6c2b6ce7e9e2471e6880caa5bbefa7..a02583d14cbae4348e13c26991a44e6a262e24b1 100644 (file)
@@ -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)
index 7235c355b04edba7e2c9e8739660616581c3638d..ad7f44444045d61caff4ac08afb6fd6df13c172b 100644 (file)
@@ -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)
index cb728335f9ce44486af325b95d83ec89f1a200af..c0e064d9a4eb0f1124a95fe9fe40ff2681d379b6 100644 (file)
@@ -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;
 }
index 1f6ea958002ea335dfbe36c80ad7484f6670d547..80eb4ad9f3210198f7720c33fea02632eacc3871 100644 (file)
@@ -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
index 6437d64906b1e768c7f6cb8c99ff1557ba16a478..b2495c702204e3acfc1f04748428621c36a9aa50 100644 (file)
@@ -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
index 9a38704aebd404268cda4c8055843687721f3158..6792d719d31bbbdc52288b71e5f4ea54f74a3ac3 100644 (file)
@@ -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);
 }
index fb44b426bcd127ec365486bdff9d276f2e8475d8..d0c77a62e636c4403ced985540f3611e128552e4 100644 (file)
@@ -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);
 }
index 7e5e6e81642ae8532446a07470d078f0e4ca7af6..21174dfbab049b524055fa39870538b20b2135ab 100644 (file)
@@ -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;
index 66e582e995e74b6f228408e3cf160eeeb8a090ac..3c5ffe454c564ff210f9c94d769b9b940f473ac7 100644 (file)
@@ -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;
     }
   }
index 2eb58089c4f3d3c4e9bc09f94b66b6233c27cf43..adece95ef8dec555201043a30183c1076cc1c3fb 100644 (file)
@@ -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;
index 91708df51f11a1b21a7a2458b69bb31a56ab495d..fca6cd899703872885ca99a124559d95e2d48bf3 100644 (file)
@@ -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);
            }
        }
     }
index 815fcf8ab371cbe02cdcbee307721662c52ec4a5..4d98b8c5e8f5a346ee1ff3e7dbe9750012a03136 100644 (file)
@@ -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;
index 0feba6687a259542e8f31e805a196e98c530a772..85bad97d2d7ea7d811cf56a3d4c49be3b584bea9 100644 (file)
@@ -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)
index ff7be11509de1d1372cda1242373855e4f5434fb..887d048e1958a59595b40fa35ab3469214fe71cf 100644 (file)
@@ -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.  */
index 4dd776843150efc505a3ccf2e75a51d113e01715..1ea9bc4e07d4273862daf22d4ccfe36cf28e3914 100644 (file)
                          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 ();
 
index 9fc24b7d92d90e2e3018fe1760b504a72d131a03..19808b50d63759f259071c91a210800a2cecada4 100644 (file)
@@ -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
     {
index 3c4062488ea4bd7b4ffff83401fdd4aff6b506db..1b0eb15fd747654074ffb73838d5a451398e29b8 100644 (file)
@@ -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;
            }
index d0004b97f17c34a88abcd62f76a51a2a0204448f..dc94e221ab97c80ef034f37a24bb43183368a427 100644 (file)
@@ -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;
 
index 67b84f184f01dd3404e5d1d47288f9f65d1c1d94..dfeb6de70fc1a83fc954ff472482cf99066872f5 100644 (file)
@@ -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;
 }
index becdd5066d6b65c0d14ad530ba45c83f290f233a..933d001341b3110f63d15166b98d22ada48f1eae 100644 (file)
@@ -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);
   /*
index 961c82edd243e1e0f2a34a724a054c66a239814d..bc5f72d6a60942a0e0ca93595a2efbe9f1dcb0cd 100644 (file)
@@ -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;
index 13fefd9e8344bea717e1b17369dddd3d68c8cb30..6d817651c97f559b7b8d69f386882284e24e8ef3 100644 (file)
@@ -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 *,
index fc0928676d89c8e96f4543741b62b7c8a6f18100..a78c670bfbd9804143f1be71bb16b827a01dfb74 100644 (file)
@@ -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;
 
index a09acb5d89bf05693fb3e9beb1ce32b9fbeea0b7..f7290106cef1abac5419bb45f4c7e0b297710527 100644 (file)
@@ -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
index e5013d00575bd0d490789a3c5f4f52867b1ad454..c4cb34d02cbc71beb625356f15f96e6eb33b9097 100644 (file)
@@ -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
 
index 4a20f1d673edb24e7a2a538f7d8c58f5d163af76..9b2e635d608a05d7e56c028d27e5b3338026d29f 100644 (file)
@@ -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
index f186182cf68826ec0d6604dd7902bad386cab194..7fbb7543d6e00bb456b1ce13e3b76b7aaa8d1ccb 100644 (file)
    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;
 
index 82f06332be780b86cd79bc4d482289b10608d267..81d99326751e4c863f0fbcb2fd769efcfb40e40a 100644 (file)
@@ -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
index 1d684ad3673ed0cde26ff525e734b5c022ea749c..4695d9261809800279ce8fe3c28b4a4d95409ac7 100644 (file)
@@ -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
index f743f702f0445e9b3076827aee2bb9f6ef1e9a21..e6720f0ca230c3b70de60cd9e4a40f4e891e2c32 100644 (file)
@@ -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);
index 2843c6e9ccb1a87e314864d1e7f98954bd60fa93..5d6bb6fe4492efcd08f3048e1684845c0b1fec8f 100644 (file)
@@ -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
index 7a9aa5738ef11fae8ed977c0e714f86afad86e6d..166bae59bfaccbca54d9ef8aff77571768186491 100644 (file)
@@ -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
index d1ce925ac3463e9dbecae0a38ca93095ef153358..b7e173689126df285c212ee2207b7b95b62f64b0 100644 (file)
@@ -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 */
index 4caeaeaf50257e74c4a8e25a532a498364be865c..31b55d73f215f7583232ac69d7ca1a9ad5b2d169 100644 (file)
@@ -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.  */
index 82f06332be780b86cd79bc4d482289b10608d267..81d99326751e4c863f0fbcb2fd769efcfb40e40a 100644 (file)
@@ -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
index e8cc3987e30e5950436aee5a45ff1a165db19824..022f24ac171b2408b57cba341647ea970b0256bc 100644 (file)
@@ -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
index 63453ca031b0903ba4dc9ecba69ae51e24357cec..28e3e535baf3cb42cb86d5d97e01c271497ff520 100644 (file)
@@ -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;
index ad4c1443e40a74b882d5fa45f85f8eb2ceac144c..771de607113f0cef8eefb6555da260d5a9afc542 100644 (file)
@@ -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