[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r8565 - in /fsf/trunk/libc: ./ debug/ elf/ libio/ localedata/ localedata/locales/ login/ login/programs/ malloc/ nscd/ nss/ ...



Author: eglibc
Date: Wed Jun 17 00:07:20 2009
New Revision: 8565

Log:
Import glibc-mainline for 2009-06-17

Removed:
    fsf/trunk/libc/sysdeps/unix/sysv/linux/grantpt.c
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/Makeconfig
    fsf/trunk/libc/debug/xtrace.sh
    fsf/trunk/libc/elf/Makefile
    fsf/trunk/libc/elf/sln.c
    fsf/trunk/libc/libio/Makefile
    fsf/trunk/libc/localedata/ChangeLog
    fsf/trunk/libc/localedata/locales/de_AT
    fsf/trunk/libc/login/Makefile
    fsf/trunk/libc/login/programs/pt_chown.c
    fsf/trunk/libc/malloc/memusage.sh
    fsf/trunk/libc/nscd/Makefile
    fsf/trunk/libc/nss/getent.c
    fsf/trunk/libc/posix/getconf.c
    fsf/trunk/libc/string/test-memchr.c
    fsf/trunk/libc/sunrpc/rpcinfo.c
    fsf/trunk/libc/sysdeps/generic/pty-private.h
    fsf/trunk/libc/sysdeps/powerpc/powerpc32/power6/memcpy.S
    fsf/trunk/libc/sysdeps/powerpc/powerpc32/power6/memset.S
    fsf/trunk/libc/sysdeps/unix/grantpt.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/lddlibc4.c
    fsf/trunk/libc/sysdeps/x86_64/memchr.S

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Wed Jun 17 00:07:20 2009
@@ -1,12 +1,62 @@
+2009-06-16  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* login/Makefile: Build pt_chown as PIE.
+
+2009-06-15  Andreas Schwab  <aschwab@xxxxxxxxxx>
+
+	* debug/xtrace.sh (do_help): Don't treat bug reporting message as
+	a format string.
+	* elf/sln.c (usage): Likewise.
+	* malloc/memusage.sh (do_help): Likewise.
+	* nss/getent.c (more_help): Likewise.
+	* posix/getconf.c (main): Likewise.
+	* sunrpc/rpcinfo.c (usage): Likewise.
+	* sysdeps/unix/sysv/linux/lddlibc4.c (main): Likewise.
+
+2009-06-16  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* login/programs/pt_chown.c: Use libcap to drop privileges other than
+	those needed.
+	* login/Makefile: If necessary link pt_chown with -lcap.
+	* sysdeps/generic/pty-private.h: Define FAIL_ENOMEM.
+	* sysdeps/unix/grantpt.c: Handle FAIL_ENOMEM.
+
+2009-06-16  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* sysdeps/x86_64/memchr.S (memchr): Use unsigned instead of signed
+	comparisons.
+	* string/test-memchr.c (do_random_tests): Test very large lengths
+	as well.
+
+2009-06-02  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* Makeconfig (+link-pie): Define.
+	(+prectorS): Define.
+	(+postctorS): Define.
+	* elf/Makefile ($(objpfx)tst-pie1): Use $(+link-pie).
+	* nscd/Makefile ($(objpfx)nscd): Likewise.
+
+2009-04-22  Ryan S. Arnold  <rsa@xxxxxxxxxx>
+
+	[BZ #10107]
+	* sysdeps/powerpc/powerpc32/power6/memcpy.S (memcpy): Replace cmpldi
+	with cmplwi.
+	* sysdeps/powerpc/powerpc32/power6/memset.S (memset): Likewise.
+
+2009-06-16  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/grantpt.c: Remove file after folding changes
+	into ...
+	* sysdeps/unix/grantpt.c: ...here.
+
 2009-06-15  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* sysdeps/unix/sysv/linux/grantpt.c (grantpt): Only call chown and
 	chmod if it is necessary.
 
 	[BZ #10166]
-	* sysdeps/unix/sysv/linux/grantpt.c: If slave device is on devpts or
-	devfs, the mode might not be correct.  Check it and return only if it
-	is correct.
+	* sysdeps/unix/sysv/linux/grantpt.c: Remove shortcut which was used
+	when the slave device is in devpts or devfs.
 
 	[BZ #10183]
 	* posix/tst-cpucount.c: Don't try more than CPU_SETSIZE bits.
@@ -26,6 +76,7 @@
 
 	[BZ #10196]
 	* libio/tst-fgetwc.c (do_test): Use de_DE.UTF-8 as locale name.
+	* libio/Makefile: Run tst-fgetwc with necessary envvar.
 	Patch by Bruce Dubbs <bdubbs@xxxxxxxxxxxxxxxxxxxx>.
 
 	[BZ #10217]

Modified: fsf/trunk/libc/Makeconfig
==============================================================================
--- fsf/trunk/libc/Makeconfig (original)
+++ fsf/trunk/libc/Makeconfig Wed Jun 17 00:07:20 2009
@@ -434,6 +434,19 @@
 			   $(common-objpfx)libc% $(+postinit),$^) \
 	      $(link-extra-libs) $(link-libc) $(+postctor) $(+postinit)
 endif
+# Command for linking PIE programs with the C library.
+ifndef +link-pie
++link-pie = $(CC) -pie -Wl,-O1 -nostdlib -nostartfiles -o $@ \
+	     $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
+	     $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
+	     $(addprefix $(csu-objpfx),S$(start-installed-name)) \
+	     $(+preinit) $(+prectorS) \
+	     $(filter-out $(addprefix $(csu-objpfx),start.o \
+	     S$(start-installed-name))\
+	     $(+preinit) $(link-extra-libs) \
+	     $(common-objpfx)libc% $(+postinit),$^) \
+	     $(link-extra-libs) $(link-libc) $(+postctorS) $(+postinit)
+endif
 # Command for statically linking programs with the C library.
 ifndef +link-static
 +link-static = $(CC) -nostdlib -nostartfiles -static -o $@ \
@@ -538,6 +551,9 @@
 +postinit = $(addprefix $(csu-objpfx),crtn.o)
 +prector = `$(CC) --print-file-name=crtbegin.o`
 +postctor = `$(CC) --print-file-name=crtend.o`
+# Variants of the two previous definitions for linking PIE programs.
++prectorS = `$(CC) --print-file-name=crtbeginS.o`
++postctorS = `$(CC) --print-file-name=crtendS.o`
 +interp = $(addprefix $(elf-objpfx),interp.os)
 endif
 csu-objpfx = $(common-objpfx)csu/

Modified: fsf/trunk/libc/debug/xtrace.sh
==============================================================================
--- fsf/trunk/libc/debug/xtrace.sh (original)
+++ fsf/trunk/libc/debug/xtrace.sh Wed Jun 17 00:07:20 2009
@@ -55,7 +55,7 @@
 short options.
 
 "
-  printf $"For bug reporting instructions, please see:
+  echo $"For bug reporting instructions, please see:
 <http://www.gnu.org/software/libc/bugs.html>.
 "
   exit 0

Modified: fsf/trunk/libc/elf/Makefile
==============================================================================
--- fsf/trunk/libc/elf/Makefile (original)
+++ fsf/trunk/libc/elf/Makefile Wed Jun 17 00:07:20 2009
@@ -852,14 +852,7 @@
 	  $< > $@
 
 $(objpfx)tst-pie1: $(objpfx)tst-pie1.o $(objpfx)tst-piemod1.so
-	$(LINK.o) -pie -Wl,-O1 \
-	  $(sysdep-LDFLAGS) $(config-LDFLAGS) \
-	  $(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) \
-	  $(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \
-	  $(LDFLAGS) $(LDFLAGS-$(@F)) \
-	  -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \
-	  -o $@ $(objpfx)tst-pie1.o $(objpfx)tst-piemod1.so \
-	  $(common-objpfx)libc_nonshared.a
+	$(+link-pie)
 
 generated += tst-pie1 tst-pie1.out tst-pie1.o
 endif

Modified: fsf/trunk/libc/elf/sln.c
==============================================================================
--- fsf/trunk/libc/elf/sln.c (original)
+++ fsf/trunk/libc/elf/sln.c Wed Jun 17 00:07:20 2009
@@ -83,8 +83,8 @@
 usage (void)
 {
   printf (_("Usage: sln src dest|file\n\n"));
-  printf (_("For bug reporting instructions, please see:\n\
-<http://www.gnu.org/software/libc/bugs.html>.\n"));
+  fputs (_("For bug reporting instructions, please see:\n\
+<http://www.gnu.org/software/libc/bugs.html>.\n"), stdout);
 }
 
 static int

Modified: fsf/trunk/libc/libio/Makefile
==============================================================================
--- fsf/trunk/libc/libio/Makefile (original)
+++ fsf/trunk/libc/libio/Makefile Wed Jun 17 00:07:20 2009
@@ -153,6 +153,7 @@
 bug-ungetwc2-ENV = LOCPATH=$(common-objpfx)localedata
 tst-swscanf-ENV = LOCPATH=$(common-objpfx)localedata
 bug-ftell-ENV = LOCPATH=$(common-objpfx)localedata
+tst-fgetwc-ENV = LOCPATH=$(common-objpfx)localedata
 
 generated = tst-fopenloc.mtrace tst-fopenloc.check
 

Modified: fsf/trunk/libc/localedata/ChangeLog
==============================================================================
--- fsf/trunk/libc/localedata/ChangeLog (original)
+++ fsf/trunk/libc/localedata/ChangeLog Wed Jun 17 00:07:20 2009
@@ -1,3 +1,9 @@
+2009-06-16  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #10011]
+	* locales/de_AT: Define week, first_weekday, first_workday.
+	Patch by Paul Marcher <flyer@xxxxxxxxx>.
+
 2009-06-15  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	[BZ #10213]

Modified: fsf/trunk/libc/localedata/locales/de_AT
==============================================================================
--- fsf/trunk/libc/localedata/locales/de_AT (original)
+++ fsf/trunk/libc/localedata/locales/de_AT Wed Jun 17 00:07:20 2009
@@ -121,6 +121,9 @@
 date_fmt	"<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
 <U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
 <U0025><U005A><U0020><U0025><U0059>"
+week    7;19971130;4
+first_weekday 2
+first_workday 2
 END LC_TIME
 
 LC_PAPER

Modified: fsf/trunk/libc/login/Makefile
==============================================================================
--- fsf/trunk/libc/login/Makefile (original)
+++ fsf/trunk/libc/login/Makefile Wed Jun 17 00:07:20 2009
@@ -1,4 +1,4 @@
-# Copyright (C) 1996-1998,2000-2002,2003,2007 Free Software Foundation, Inc.
+# Copyright (C) 1996-1998,2000-2003,2007, 2009 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
@@ -54,6 +54,24 @@
 	     $(resolvobjdir)/libresolv.a $(common-objpfx)libc.a
 endif
 
+ifeq (yesyes,$(have-fpie)$(build-shared))
+pt_chown-cflags += $(pie-ccflag)
+endif
+ifeq (yes,$(have-ssp))
+pt_chown-cflags += -fstack-protector
+endif
+ifeq (yes,$(have-libcap))
+libcap = -lcap
+endif
+CFLAGS-pt_chown.c = $(pt_chown-cflags)
+LDLIBS-pt_chown = $(libcap)
+ifeq (yesyes,$(have-fpie)$(build-shared))
+LDFLAGS-pt_chown = -Wl,-z,now
+
+$(objpfx)pt_chown: $(objpfx)pt_chown.o
+	$(+link-pie)
+endif
+
 # pt_chown needs to be setuid root.
 $(inst_libexecdir)/pt_chown: $(objpfx)pt_chown $(+force)
 	$(make-target-directory)

Modified: fsf/trunk/libc/login/programs/pt_chown.c
==============================================================================
--- fsf/trunk/libc/login/programs/pt_chown.c (original)
+++ fsf/trunk/libc/login/programs/pt_chown.c Wed Jun 17 00:07:20 2009
@@ -29,6 +29,10 @@
 #include <string.h>
 #include <sys/stat.h>
 #include <unistd.h>
+#ifdef HAVE_LIBCAP
+# include <sys/capability.h>
+# include <sys/prctl.h>
+#endif
 
 #include "pty-private.h"
 
@@ -99,7 +103,7 @@
 do_pt_chown (void)
 {
   char *pty;
-  struct stat st;
+  struct stat64 st;
   struct group *p;
   gid_t gid;
 
@@ -110,7 +114,7 @@
 
   /* Check that the returned slave pseudo terminal is a
      character device.  */
-  if (stat (pty, &st) < 0 || !S_ISCHR(st.st_mode))
+  if (stat64 (pty, &st) < 0 || !S_ISCHR (st.st_mode))
     return FAIL_EINVAL;
 
   /* Get the group ID of the special `tty' group.  */
@@ -136,16 +140,43 @@
 main (int argc, char *argv[])
 {
   uid_t euid = geteuid ();
+  uid_t uid = getuid ();
   int remaining;
 
-  /* Normal invocation of this program is with no arguments and
-     with privileges.
-     FIXME: Should use capable (CAP_CHOWN|CAP_FOWNER).  */
   if (argc == 1 && euid == 0)
-    return do_pt_chown ();
+    {
+#ifdef HAVE_LIBCAP
+  /* Drop privileges.  */
+      if (uid != euid)
+	{
+	  static const cap_value_t cap_list[] =
+	    { CAP_CHOWN, CAP_FOWNER	};
+# define ncap_list (sizeof (cap_list) / sizeof (cap_list[0]))
+	  cap_t caps = cap_init ();
+	  if (caps == NULL)
+	    error (FAIL_ENOMEM, errno,
+		   _("Failed to initialize drop of capabilities"));
+
+	  /* There is no reason why these should not work.  */
+	  cap_set_flag (caps, CAP_PERMITTED, ncap_list, cap_list, CAP_SET);
+	  cap_set_flag (caps, CAP_EFFECTIVE, ncap_list, cap_list, CAP_SET);
+
+	  int res = cap_set_proc (caps);
+
+	  cap_free (caps);
+
+	  if (__builtin_expect (res != 0, 0))
+	    error (FAIL_EXEC, errno, _("cap_set_proc failed"));
+	}
+#endif
+
+      /* Normal invocation of this program is with no arguments and
+	 with privileges.  */
+      return do_pt_chown ();
+    }
 
   /* We aren't going to be using privileges, so drop them right now. */
-  setuid (getuid ());
+  setuid (uid);
 
   /* Set locale via LC_ALL.  */
   setlocale (LC_ALL, "");

Modified: fsf/trunk/libc/malloc/memusage.sh
==============================================================================
--- fsf/trunk/libc/malloc/memusage.sh (original)
+++ fsf/trunk/libc/malloc/memusage.sh Wed Jun 17 00:07:20 2009
@@ -62,7 +62,7 @@
 short options.
 
 "
-  print $"For bug reporting instructions, please see:
+  echo $"For bug reporting instructions, please see:
 <http://www.gnu.org/software/libc/bugs.html>.
 "
   exit 0

Modified: fsf/trunk/libc/nscd/Makefile
==============================================================================
--- fsf/trunk/libc/nscd/Makefile (original)
+++ fsf/trunk/libc/nscd/Makefile Wed Jun 17 00:07:20 2009
@@ -1,5 +1,4 @@
-# Copyright (C) 1998,2000,2002,2003,2004,2005,2006,2007,2008
-#	Free Software Foundation, Inc.
+# Copyright (C) 1998,2000,2002-2009 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
@@ -128,13 +127,7 @@
 relro-LDFLAGS += -Wl,-z,now
 
 $(objpfx)nscd: $(addprefix $(objpfx),$(nscd-modules:=.o))
-	$(LINK.o) -pie -Wl,-O1 $(nscd-cflags) \
-	  $(sysdep-LDFLAGS) $(config-LDFLAGS) $(relro-LDFLAGS) \
-	  $(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) \
-	  $(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \
-	  $(LDFLAGS) $(LDFLAGS-$(@F)) \
-	  -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \
-	  -o $@ $^ $(LDLIBS-nscd) $(common-objpfx)libc_nonshared.a
+	$(+link-pie)
 endif
 
 # This makes sure -DNOT_IN_libc is passed for all these modules.

Modified: fsf/trunk/libc/nss/getent.c
==============================================================================
--- fsf/trunk/libc/nss/getent.c (original)
+++ fsf/trunk/libc/nss/getent.c Wed Jun 17 00:07:20 2009
@@ -905,9 +905,9 @@
 
 	  fputs ("\n\n", fp);
 
-	  fprintf (fp, gettext ("\
+	  fputs (gettext ("\
 For bug reporting instructions, please see:\n\
-<http://www.gnu.org/software/libc/bugs.html>.\n"));
+<http://www.gnu.org/software/libc/bugs.html>.\n"), fp);
 
 	  if (fclose (fp) == 0)
 	    return doc;

Modified: fsf/trunk/libc/posix/getconf.c
==============================================================================
--- fsf/trunk/libc/posix/getconf.c (original)
+++ fsf/trunk/libc/posix/getconf.c Wed Jun 17 00:07:20 2009
@@ -1118,8 +1118,8 @@
 Get the configuration value for variable VAR, or for variable PATH_VAR\n\
 for path PATH.  If SPEC is given, give values for compilation\n\
 environment SPEC.\n\n"));
-      printf (gettext ("For bug reporting instructions, please see:\n\
-<http://www.gnu.org/software/libc/bugs.html>.\n"));
+      fputs (gettext ("For bug reporting instructions, please see:\n\
+<http://www.gnu.org/software/libc/bugs.html>.\n"), stdout);
       return 0;
     }
 

Modified: fsf/trunk/libc/string/test-memchr.c
==============================================================================
--- fsf/trunk/libc/string/test-memchr.c (original)
+++ fsf/trunk/libc/string/test-memchr.c Wed Jun 17 00:07:20 2009
@@ -1,5 +1,5 @@
 /* Test and measure memchr functions.
-   Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Jakub Jelinek <jakub@xxxxxxxxxx>, 1999.
 
@@ -144,7 +144,12 @@
 	}
 
       if (pos < len)
-	result = (char *) (p + pos + align);
+	{
+	  size_t r = random ();
+	  if ((r & 31) == 0)
+	    len = ~(uintptr_t) (p + align) - ((r >> 5) & 31);
+	  result = (char *) (p + pos + align);
+	}
       else
 	result = NULL;
 

Modified: fsf/trunk/libc/sunrpc/rpcinfo.c
==============================================================================
--- fsf/trunk/libc/sunrpc/rpcinfo.c (original)
+++ fsf/trunk/libc/sunrpc/rpcinfo.c Wed Jun 17 00:07:20 2009
@@ -688,9 +688,9 @@
   fputs (_("       rpcinfo -b prognum versnum\n"), stream);
   fputs (_("       rpcinfo -d prognum versnum\n"), stream);
   fputc ('\n', stream);
-  fprintf (stream, _("\
+  fputs (_("\
 For bug reporting instructions, please see:\n\
-<http://www.gnu.org/software/libc/bugs.html>.\n"));
+<http://www.gnu.org/software/libc/bugs.html>.\n"), stream);
 }
 
 static void

Modified: fsf/trunk/libc/sysdeps/generic/pty-private.h
==============================================================================
--- fsf/trunk/libc/sysdeps/generic/pty-private.h (original)
+++ fsf/trunk/libc/sysdeps/generic/pty-private.h Wed Jun 17 00:07:20 2009
@@ -1,5 +1,5 @@
 /* Internal defenitions and declarations for pseudo terminal functions.
-   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Zack Weinberg <zack@xxxxxxxxxxxxxxxxxxxxxx>, 1998.
 
@@ -39,7 +39,8 @@
   FAIL_EBADF = 1,
   FAIL_EINVAL,
   FAIL_EACCES,
-  FAIL_EXEC
+  FAIL_EXEC,
+  FAIL_ENOMEM
 };
 
 #endif /* pty-private.h  */

Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/power6/memcpy.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/power6/memcpy.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/power6/memcpy.S Wed Jun 17 00:07:20 2009
@@ -1,5 +1,5 @@
 /* Optimized memcpy implementation for PowerPC32 on POWER6.
-   Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006, 2009 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
@@ -25,9 +25,9 @@
    Returns 'dst'.
 
    Memcpy handles short copies (< 32-bytes) using a binary move blocks 
-   (no loops) of lwz/stw.  The tail (remaining 1-3) bytes is handled 
-   with the appropriate combination of byte and halfword load/stores. 
-   There is minimal effort to optimize the alignment of short moves.  
+   (no loops) of lwz/stw.  The tail (remaining 1-3) bytes is handled
+   with the appropriate combination of byte and halfword load/stores.
+   There is minimal effort to optimize the alignment of short moves.
 
    Longer moves (>= 32-bytes) justify the effort to get at least the
    destination word (4-byte) aligned.  Further optimization is
@@ -80,11 +80,11 @@
     bne-   cr6,L(wdu)   /* If source is not word aligned. .L6 */
     clrlwi 11,31,30  /* calculate the number of tail bytes */
     b      L(word_aligned)
-  /* Copy words from source to destination, assuming the destination is 
+  /* Copy words from source to destination, assuming the destination is
      aligned on a word boundary.
 
      At this point we know there are at least 29 bytes left (32-3) to copy.
-     The next step is to determine if the source is also word aligned. 
+     The next step is to determine if the source is also word aligned.
      If not branch to the unaligned move code at .L6. which uses
      a load, shift, store strategy.
 
@@ -100,9 +100,9 @@
 
   /* Move words where destination and source are word aligned.
      Use an unrolled loop to copy 4 words (16-bytes) per iteration.
-     If the the copy is not an exact multiple of 16 bytes, 1-3 
+     If the the copy is not an exact multiple of 16 bytes, 1-3
      words are copied as needed to set up the main loop.  After
-     the main loop exits there may be a tail of 1-3 bytes. These bytes are 
+     the main loop exits there may be a tail of 1-3 bytes. These bytes are
      copied a halfword/byte at a time as needed to preserve alignment.  */
 L(word_aligned):
     mtcrf 0x01,9
@@ -121,7 +121,7 @@
     addi  10,3,8
     bf    31,4f
     lwz   0,8(12)
-    stw   0,8(3)    
+    stw   0,8(3)
     blt   cr1,3f
     addi  11,12,12
     addi  10,3,12
@@ -135,7 +135,7 @@
     addi  11,12,4
     stw   6,0(3)
     addi  10,3,4
-    
+
     .align  4
 4:
     lwz   6,0(11)
@@ -149,14 +149,14 @@
     addi  11,11,16
     addi  10,10,16
     bdnz  4b
-3:  
+3:
     clrrwi 0,31,2
     mtcrf 0x01,31
     beq   cr6,0f
 .L9:
     add   3,3,0
     add   12,12,0
-    
+
 /*  At this point we have a tail of 0-3 bytes and we know that the
     destination is word aligned.  */
 2:  bf    30,1f
@@ -175,7 +175,7 @@
     addi 1,1,32
     blr
 
-/* Copy up to 31 bytes.  This divided into two cases 0-8 bytes and 9-31 
+/* Copy up to 31 bytes.  This divided into two cases 0-8 bytes and 9-31
    bytes.  Each case is handled without loops, using binary (1,2,4,8)
    tests.
 
@@ -208,7 +208,7 @@
     andi. 0,8,3
     beq   cr6,L(wus_8)	/* Handle moves of 8 bytes.  */
 /* At least 9 bytes left.  Get the source word aligned.  */
-    cmpldi	cr1,5,16
+    cmplwi	cr1,5,16
     mr    12,4
     ble   cr6,L(wus_4)  /* Handle moves of 0-8 bytes.  */
     mr    11,3
@@ -241,7 +241,7 @@
 /* At least 6 bytes left and the source is word aligned.  This allows
    some speculative loads up front.  */
 /* We need to special case the fall-through because the biggest delays
-   are due to address computation not being ready in time for the 
+   are due to address computation not being ready in time for the
    AGEN.  */
     lwz   6,0(12)
     lwz   7,4(12)
@@ -336,7 +336,7 @@
 L(wus_tail2):  /* Move 2-3 bytes.  */
     bf    30,L(wus_tail1)
     lhz   6,0(12)
-    sth   6,0(11) 
+    sth   6,0(11)
     bf    31,L(wus_tailX)
     lbz   7,2(12)
     stb   7,2(11)
@@ -368,7 +368,7 @@
     stw   6,0(3)
     bf    30,L(wus_5)
     lhz   7,4(4)
-    sth   7,4(3) 
+    sth   7,4(3)
     bf    31,L(wus_0)
     lbz   8,6(4)
     stb   8,6(3)
@@ -386,7 +386,7 @@
 L(wus_2):  /* Move 2-3 bytes.  */
     bf    30,L(wus_1)
     lhz   6,0(4)
-    sth   6,0(3) 
+    sth   6,0(3)
     bf    31,L(wus_0)
     lbz   7,2(4)
     stb   7,2(3)
@@ -410,13 +410,13 @@
 
   /* Copy words where the destination is aligned but the source is
      not.  For power4, power5 and power6 machines there is penalty for
-     unaligned loads (src) that cross 32-byte, cacheline, or page 
+     unaligned loads (src) that cross 32-byte, cacheline, or page
      boundaries. So we want to use simple (unaligned) loads where
      posible but avoid them where we know the load would span a 32-byte
-     boundary. 
+     boundary.
 
      At this point we know we have at least 29 (32-3) bytes to copy
-     the src is unaligned. and we may cross at least one 32-byte 
+     the src is unaligned. and we may cross at least one 32-byte
      boundary. Also we have the following regester values:
      r3 == adjusted dst, word aligned
      r4 == unadjusted src
@@ -427,7 +427,7 @@
      r31 == adjusted len
 
      First we need to copy word upto but not crossing the next 32-byte
-     boundary. Then perform aligned loads just before and just after 
+     boundary. Then perform aligned loads just before and just after
      the boundary and use shifts and or to gernerate the next aligned
      word for dst. If more then 32 bytes remain we copy (unaligned src)
      the next 7 words and repeat the loop until less then 32-bytes
@@ -442,7 +442,7 @@
     mr      4,12      /* restore unaligned adjusted src ptr */
     clrlwi  0,12,27   /* Find dist from previous 32-byte boundary.  */
     slwi    10,10,3   /* calculate number of bits to shift 1st word left */
-    cmplwi  cr5,0,16   
+    cmplwi  cr5,0,16
     subfic  8,0,32   /* Number of bytes to next 32-byte boundary.  */
 
     mtcrf   0x01,8
@@ -532,7 +532,7 @@
     lwz     6,0(12)
     cmplwi  cr6,31,4
     srwi    8,31,5    /* calculate the 32 byte loop count */
-    slw     0,6,10 
+    slw     0,6,10
     clrlwi  31,31,27   /* The remaining bytes, < 32.  */
     blt     cr5,L(wdu_32tail)
     mtctr   8
@@ -543,7 +543,7 @@
     lwz   8,4(12)
     addi  12,12,32
     lwz   7,4(4)
-    srw   8,8,9 
+    srw   8,8,9
     or    0,0,8
     stw   0,0(3)
     stw   7,4(3)
@@ -562,7 +562,7 @@
     stw   6,24(3)
     stw   7,28(3)
     addi  3,3,32
-    slw   0,8,10 
+    slw   0,8,10
     bdnz+ L(wdu_loop32)
 
 L(wdu_32tail):
@@ -571,7 +571,7 @@
     blt     cr6,L(wdu_4tail)
     /* calculate and store the final word */
     lwz   8,4(12)
-    srw   8,8,9 
+    srw   8,8,9
     or    6,0,8
     b     L(wdu_32tailx)
 #endif
@@ -816,7 +816,7 @@
     beq   cr6,L(wdus_0)	/* If the tail is 0 bytes we are done!  */
     bf    30,L(wdus_3)
     lhz   7,0(4)
-    sth   7,0(3) 
+    sth   7,0(3)
     bf    31,L(wdus_0)
     lbz   8,2(4)
     stb   8,2(3)

Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/power6/memset.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/power6/memset.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/power6/memset.S Wed Jun 17 00:07:20 2009
@@ -1,5 +1,5 @@
 /* Optimized 32-bit memset implementation for POWER6.
-   Copyright (C) 1997,99, 2000,02,03,06,2007 Free Software Foundation, Inc.
+   Copyright (C) 1997,99,2000,02,03,06,2007,2009 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
@@ -240,7 +240,7 @@
 	cmplwi	cr1,rLEN,256
 	addi	rMEMP3,rMEMP,64
 #ifdef NOT_IN_libc
-/* When we are not in libc we should use only GPRs to avoid the FPU lock 
+/* When we are not in libc we should use only GPRs to avoid the FPU lock
    interrupt.  */
 	stw	rCHR,0(rMEMP)
         stw     rCHR,4(rMEMP)
@@ -381,7 +381,7 @@
 	blt	cr1,L(cacheAligned1)
 	li	rMEMP2,128
 L(cacheAlignedx):
-	cmpldi	cr5,rLEN,640
+	cmplwi	cr5,rLEN,640
 	blt	cr6,L(cacheAligned128)
 	bgt	cr5,L(cacheAligned512)
 	cmplwi	cr6,rLEN,512

Modified: fsf/trunk/libc/sysdeps/unix/grantpt.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/grantpt.c (original)
+++ fsf/trunk/libc/sysdeps/unix/grantpt.c Wed Jun 17 00:07:20 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000, 2001, 2002, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Zack Weinberg <zack@xxxxxxxxxxxxxxxxxxxxxx>, 1998.
 
@@ -19,6 +19,7 @@
 
 #include <assert.h>
 #include <errno.h>
+#include <fcntl.h>
 #include <grp.h>
 #include <limits.h>
 #include <stdlib.h>
@@ -115,8 +116,24 @@
   gid_t gid;
   pid_t pid;
 
-  if (pts_name (fd, &buf, sizeof (_buf)))
-    return -1;
+  if (__builtin_expect (pts_name (fd, &buf, sizeof (_buf)), 0))
+    {
+      int save_errno = errno;
+
+      /* Check, if the file descriptor is valid.  pts_name returns the
+	 wrong errno number, so we cannot use that.  */
+      if (__libc_fcntl (fd, F_GETFD) == -1 && errno == EBADF)
+	return -1;
+
+       /* If the filedescriptor is no TTY, grantpt has to set errno
+          to EINVAL.  */
+       if (save_errno == ENOTTY)
+         __set_errno (EINVAL);
+       else
+	 __set_errno (save_errno);
+
+       return -1;
+    }
 
   if (__xstat64 (_STAT_VER, buf, &st) < 0)
     goto cleanup;
@@ -185,7 +202,7 @@
       if (!WIFEXITED (w))
 	__set_errno (ENOEXEC);
       else
-	switch (WEXITSTATUS(w))
+	switch (WEXITSTATUS (w))
 	  {
 	  case 0:
 	    retval = 0;
@@ -202,6 +219,9 @@
 	  case FAIL_EXEC:
 	    __set_errno (ENOEXEC);
 	    break;
+	  case FAIL_ENOMEM:
+	    __set_errno (ENOMEM);
+	    break;
 
 	  default:
 	    assert(! "getpt: internal error: invalid exit code from pt_chown");

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/lddlibc4.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/lddlibc4.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/lddlibc4.c Wed Jun 17 00:07:20 2009
@@ -59,8 +59,8 @@
   if (strcmp (argv[1], "--help") == 0)
     {
       printf (gettext ("Usage: lddlibc4 FILE\n\n"));
-      printf (gettext ("For bug reporting instructions, please see:\n\
-<http://www.gnu.org/software/libc/bugs.html>.\n"));
+      fputs (gettext ("For bug reporting instructions, please see:\n\
+<http://www.gnu.org/software/libc/bugs.html>.\n"), stdout);
       return 0;
     }
   else if (strcmp (argv[1], "--version") == 0)

Modified: fsf/trunk/libc/sysdeps/x86_64/memchr.S
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/memchr.S (original)
+++ fsf/trunk/libc/sysdeps/x86_64/memchr.S Wed Jun 17 00:07:20 2009
@@ -41,7 +41,7 @@
 	movl	$16, %esi
 	jnz	1f
 	cmpq	%rsi, %rdx
-	jle	3f
+	jbe	3f
 
 2:	movdqa	(%rdi,%rsi), %xmm0
 	leaq	16(%rsi), %rsi
@@ -50,7 +50,7 @@
 	testl	%ecx, %ecx
 	jnz	1f
 	cmpq	%rsi, %rdx
-	jg	2b
+	ja	2b
 
 3:	xorl	%eax, %eax
 	ret
@@ -60,7 +60,7 @@
 	addq	%rcx, %rax
 	leaq	-16(%rsi,%rcx), %rsi
 	cmpq	%rsi, %rdx
-	jle	3b
+	jbe	3b
 	ret
 END (memchr)