about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog52
-rw-r--r--Makerules2
-rw-r--r--grp/Makefile9
-rw-r--r--inet/Makefile4
-rw-r--r--io/Makefile4
-rw-r--r--io/fcntl.h7
-rw-r--r--io/fts.h8
-rw-r--r--libio/stdio.h2
-rw-r--r--locale/loadarchive.c13
-rw-r--r--malloc/hooks.c52
-rw-r--r--malloc/malloc.c22
-rw-r--r--misc/Makefile1
-rw-r--r--misc/err.h18
-rw-r--r--posix/Makefile8
-rw-r--r--posix/getopt.c85
-rw-r--r--posix/getopt.h19
-rw-r--r--pwd/Makefile1
-rw-r--r--resolv/herror.c3
-rw-r--r--shadow/Makefile5
-rw-r--r--stdio-common/Makefile1
-rw-r--r--stdio-common/stdio_ext.h20
-rw-r--r--stdlib/Makefile1
-rw-r--r--sunrpc/Makefile1
23 files changed, 287 insertions, 51 deletions
diff --git a/ChangeLog b/ChangeLog
index 8097565014..0edf022426 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,55 @@
+2003-09-12  Ulrich Drepper  <drepper@redhat.com>
+
+	* grp/Makefile (CFLAGS-getgrgid_r.c, CFLAGS-getgrnam_r.c,
+	CFLAGS-fgetgrent.c, CFLAGS-fgetgrent_r.c, CFLAGS-putgrent.c,
+	CFLAGS-initgroups.c, CFLAGS-getgrgid.c): Add -fexceptions.
+	* inet/Makefile (CFLAGS-either_ntoh.c, CFLAGS-either_hton.c,
+	CFLAGS-getnetgrent.c, CFLAGS-getnetgrent_r.c): Likewise.
+	* io/Makefile (CFLAGS-posix_fallocate.c, CFLAGS-posix_fallocate64.c):
+	Likewise.
+	* misc/Makefile (CFLAGS-err.c): Likewise.
+	* posix/Makefile (CFLAGS-getaddrinfo.c, CFLAGS-spawn.c,
+	CFLAGS-spawnp.c, CFLAGS-spawni.c, CFLAGS-pause.c, CFLAGS-glob.c,
+	CFLAGS-glob64.c): Likewise.
+	* pwd/Makefile (CFLAGS-getpw.c): Likewise.
+	* shadow/Makefile (CFLAGS-fgetspent.c, CFLAGS-fgetspent_r.c,
+	CFLAGS-putspent.c, CFLAGS-getspnam.c, CFLAGS-getspnam_r.c): Likewise.
+	* stdio-common/Makefile (CFLAGS-cuserid.c): Likewise.
+	* sunrpc/Makefile (CFLAGS-openchild.c): Likewise.
+
+	* stdlib/Makefile (CFLAGS-mkstemp.c): Remove definition.
+
+	* libio/stdio.h: Remove __THROW from cuserid prototype.
+
+	* locale/loadarchive.c: Use only non-cancelable interfaces.
+	* resolv/herror.c (herror): Likewise.
+
+	* malloc/hooks.c: Before using IO stream mark stream so it uses
+	only non-cancelable interfaces.
+	* malloc/malloc.c: Likewise.
+	* posix/getopt.c: Likewise.
+
+
+2003-09-11  Jakub Jelinek  <jakub@redhat.com>
+
+	* Makerules (LDFLAGS-c.so): Remove -u __register_frame.
+
+2003-09-12  Ulrich Drepper  <drepper@redhat.com>
+
+	* stdio-common/stdio_ext.h: Mark most functions with __THROW.
+
+	* misc/err.h: Remove __THROW from all prototypes.
+
+	* posix/getopt.h (__THROW): Define if not already defined.  Add
+	__THROW to the getopt functions.
+
+2003-09-11  Ulrich Drepper  <drepper@redhat.com>
+
+	* io/Makefile (CFLAGS-lockf.c): Add -fexceptions.
+	(CFLAGS-fts.c): Likewise.
+	* io/fcntl.h: Remove __THROW from lockf prototypes.
+	* io/fts.h: Remove most __THROW.
+
 2003-09-11  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* elf/tls-macros.h (TLS_IE): Add a stop bit for ia64.
diff --git a/Makerules b/Makerules
index 56fcf29d3c..500d1af024 100644
--- a/Makerules
+++ b/Makerules
@@ -572,8 +572,6 @@ LDFLAGS-c.so = -nostdlib -nostartfiles
 LDLIBS-c.so += $(gnulib)
 # Give libc.so an entry point and make it directly runnable itself.
 LDFLAGS-c.so += -e __libc_main
-# Force the backward compatibility EH functions to be linked.
-LDFLAGS-c.so += -u __register_frame
 # Pre-link the objects of libc_pic.a so that we can locally resolve
 # COMMON symbols before we link against ld.so.  This is because ld.so
 # contains some of libc_pic.a already, which will prevent the COMMONs
diff --git a/grp/Makefile b/grp/Makefile
index 0c16c51911..1d666d0c5e 100644
--- a/grp/Makefile
+++ b/grp/Makefile
@@ -47,10 +47,15 @@ endif
 
 ifeq ($(have-thread-library),yes)
 
-CFLAGS-getgrgid_r.c = -DUSE_NSCD=1
-CFLAGS-getgrnam_r.c = -DUSE_NSCD=1
+CFLAGS-getgrgid_r.c = -DUSE_NSCD=1 -fexceptions
+CFLAGS-getgrnam_r.c = -DUSE_NSCD=1 -fexceptions
 CFLAGS-getgrent_r.c = -fexceptions
 CFLAGS-getgrent.c = -fexceptions
+CFLAGS-fgetgrent.c = -fexceptions
+CFLAGS-fgetgrent_r.c = -fexceptions
+CFLAGS-putgrent.c = -fexceptions
+CFLAGS-initgroups.c = -fexceptions
+CFLAGS-getgrgid.c = -fexceptions
 
 endif
 
diff --git a/inet/Makefile b/inet/Makefile
index 66648dd496..7b7e9b1b77 100644
--- a/inet/Makefile
+++ b/inet/Makefile
@@ -79,6 +79,10 @@ CFLAGS-getservent_r.c = -fexceptions
 CFLAGS-getservent.c = -fexceptions
 CFLAGS-getprtent_r.c = -fexceptions
 CFLAGS-getprtent.c = -fexceptions
+CFLAGS-either_ntoh.c = -fexceptions
+CFLAGS-either_hton.c = -fexceptions
+CFLAGS-getnetgrent.c = -fexceptions
+CFLAGS-getnetgrent_r.c = -fexceptions
 
 endif
 
diff --git a/io/Makefile b/io/Makefile
index 0e59459597..0082a9a886 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -71,6 +71,10 @@ CFLAGS-statfs.c = -fexceptions
 CFLAGS-fstatfs.c = -fexceptions
 CFLAGS-statvfs.c = -fexceptions
 CFLAGS-fstatvfs.c = -fexceptions
+CFLAGS-fts.c = -fexceptions
+CFLAGS-lockf.c = -fexceptions
+CFLAGS-posix_fallocate.c = -fexceptions
+CFLAGS-posix_fallocate64.c = -fexceptions
 
 CFLAGS-test-stat.c = -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
 CFLAGS-test-lfs.c = -D_LARGEFILE64_SOURCE
diff --git a/io/fcntl.h b/io/fcntl.h
index d702368b30..b81a5b7230 100644
--- a/io/fcntl.h
+++ b/io/fcntl.h
@@ -116,17 +116,16 @@ extern int creat64 (__const char *__file, __mode_t __mode);
 # define F_TEST  3	/* Test a region for other processes locks.  */
 
 # ifndef __USE_FILE_OFFSET64
-extern int lockf (int __fd, int __cmd, __off_t __len) __THROW;
+extern int lockf (int __fd, int __cmd, __off_t __len);
 # else
 # ifdef __REDIRECT
-extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len) __THROW,
-		       lockf64);
+extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len), lockf64);
 # else
 #  define lockf lockf64
 # endif
 # endif
 # ifdef __USE_LARGEFILE64
-extern int lockf64 (int __fd, int __cmd, __off64_t __len) __THROW;
+extern int lockf64 (int __fd, int __cmd, __off64_t __len);
 # endif
 #endif
 
diff --git a/io/fts.h b/io/fts.h
index a22c7bb9ca..0a070ba8dc 100644
--- a/io/fts.h
+++ b/io/fts.h
@@ -120,11 +120,11 @@ typedef struct _ftsent {
 } FTSENT;
 
 __BEGIN_DECLS
-FTSENT	*fts_children (FTS *, int) __THROW;
-int	 fts_close (FTS *) __THROW;
+FTSENT	*fts_children (FTS *, int);
+int	 fts_close (FTS *);
 FTS	*fts_open (char * const *, int,
-		   int (*)(const FTSENT **, const FTSENT **)) __THROW;
-FTSENT	*fts_read (FTS *) __THROW;
+		   int (*)(const FTSENT **, const FTSENT **));
+FTSENT	*fts_read (FTS *);
 int	 fts_set (FTS *, FTSENT *, int) __THROW;
 __END_DECLS
 
diff --git a/libio/stdio.h b/libio/stdio.h
index 140643911f..bfcc553ba9 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -782,7 +782,7 @@ extern char *ctermid (char *__s) __THROW;
 
 #ifdef __USE_XOPEN
 /* Return the name of the current user.  */
-extern char *cuserid (char *__s) __THROW;
+extern char *cuserid (char *__s);
 #endif /* Use X/Open, but not issue 6.  */
 
 
diff --git a/locale/loadarchive.c b/locale/loadarchive.c
index 3fddc7d05b..80bab9e7c9 100644
--- a/locale/loadarchive.c
+++ b/locale/loadarchive.c
@@ -1,5 +1,5 @@
 /* Code to load locale data from the locale archive file.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003 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
@@ -32,6 +32,7 @@
 
 #include "localeinfo.h"
 #include "locarchive.h"
+#include <not-cancel.h>
 
 /* Define the hash function.  We define the function as static inline.  */
 #define compute_hashval static inline compute_hashval
@@ -202,7 +203,7 @@ _nl_load_locale_from_archive (int category, const char **namep)
       archmapped = &headmap;
 
       /* The archive has never been opened.  */
-      fd = __open64 (archfname, O_RDONLY);
+      fd = open_not_cancel_2 (archfname, O_RDONLY|O_LARGEFILE);
       if (fd < 0)
 	/* Cannot open the archive, for whatever reason.  */
 	return NULL;
@@ -212,7 +213,7 @@ _nl_load_locale_from_archive (int category, const char **namep)
 	  /* stat failed, very strange.  */
 	close_and_out:
 	  if (fd >= 0)
-	    __close (fd);
+	    close_not_cancel_no_status (fd);
 	  return NULL;
 	}
 
@@ -252,7 +253,7 @@ _nl_load_locale_from_archive (int category, const char **namep)
 	{
 	  /* We've mapped the whole file already, so we can be
 	     sure we won't need this file descriptor later.  */
-	  __close (fd);
+	  close_not_cancel_no_status (fd);
 	  fd = -1;
 	}
 
@@ -393,7 +394,7 @@ _nl_load_locale_from_archive (int category, const char **namep)
 	  if (fd == -1)
 	    {
 	      struct stat64 st;
-	      fd = __open64 (archfname, O_RDONLY);
+	      fd = open_not_cancel_2 (archfname, O_RDONLY|O_LARGEFILE);
 	      if (fd == -1)
 		/* Cannot open the archive, for whatever reason.  */
 		return NULL;
@@ -446,7 +447,7 @@ _nl_load_locale_from_archive (int category, const char **namep)
 
   /* We don't need the file descriptor any longer.  */
   if (fd >= 0)
-    __close (fd);
+    close_not_cancel_no_status (fd);
   fd = -1;
 
   /* We succeeded in mapping all the necessary regions of the archive.
diff --git a/malloc/hooks.c b/malloc/hooks.c
index cf6642c930..020657a368 100644
--- a/malloc/hooks.c
+++ b/malloc/hooks.c
@@ -106,7 +106,18 @@ __malloc_check_init()
   __realloc_hook = realloc_check;
   __memalign_hook = memalign_check;
   if(check_action & 1)
-    fprintf(stderr, "malloc: using debugging hooks\n");
+    {
+#ifdef _LIBC
+      _IO_flockfile (stderr);
+      int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+      ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+#endif
+      fprintf(stderr, "malloc: using debugging hooks\n");
+#ifdef _LIBC
+      ((_IO_FILE *) stderr)->_flags2 |= old_flags2;
+      _IO_funlockfile (stderr);
+#endif
+    }
 }
 
 /* A simple, standard set of debugging hooks.  Overhead is `only' one
@@ -224,7 +235,18 @@ top_check()
      t == initial_top(&main_arena)) return 0;
 
   if(check_action & 1)
-    fprintf(stderr, "malloc: top chunk is corrupt\n");
+    {
+#ifdef _LIBC
+      _IO_flockfile (stderr);
+      int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+      ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+#endif
+      fprintf(stderr, "malloc: top chunk is corrupt\n");
+#ifdef _LIBC
+      ((_IO_FILE *) stderr)->_flags2 |= old_flags2;
+      _IO_funlockfile (stderr);
+#endif
+    }
   if(check_action & 2)
     abort();
 
@@ -278,7 +300,18 @@ free_check(mem, caller) Void_t* mem; const Void_t *caller;
   if(!p) {
     (void)mutex_unlock(&main_arena.mutex);
     if(check_action & 1)
-      fprintf(stderr, "free(): invalid pointer %p!\n", mem);
+      {
+#ifdef _LIBC
+	_IO_flockfile (stderr);
+	int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+	((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+#endif
+	fprintf(stderr, "free(): invalid pointer %p!\n", mem);
+#ifdef _LIBC
+	((_IO_FILE *) stderr)->_flags2 |= old_flags2;
+	_IO_funlockfile (stderr);
+#endif
+      }
     if(check_action & 2)
       abort();
     return;
@@ -315,7 +348,18 @@ realloc_check(oldmem, bytes, caller)
   (void)mutex_unlock(&main_arena.mutex);
   if(!oldp) {
     if(check_action & 1)
-      fprintf(stderr, "realloc(): invalid pointer %p!\n", oldmem);
+      {
+#ifdef _LIBC
+	_IO_flockfile (stderr);
+	int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+	((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+#endif
+	fprintf(stderr, "realloc(): invalid pointer %p!\n", oldmem);
+#ifdef _LIBC
+	((_IO_FILE *) stderr)->_flags2 |= old_flags2;
+	_IO_funlockfile (stderr);
+#endif
+      }
     if(check_action & 2)
       abort();
     return malloc_check(bytes, NULL);
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 6b89083880..442f17e71a 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -4139,7 +4139,18 @@ _int_free(mstate av, Void_t* mem)
     if (__builtin_expect ((uintptr_t) p > (uintptr_t) -size, 0))
       {
 	if (check_action & 1)
-	  fprintf (stderr, "free(): invalid pointer %p!\n", mem);
+	  {
+#ifdef _LIBC
+	    _IO_flockfile (stderr);
+	    int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+	    ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+#endif
+	    fprintf (stderr, "free(): invalid pointer %p!\n", mem);
+#ifdef _LIBC
+	    ((_IO_FILE *) stderr)->_flags2 |= old_flags2;
+	    _IO_funlockfile (stderr);
+#endif
+	  }
 	if (check_action & 2)
 	  abort ();
 	return;
@@ -5108,6 +5119,11 @@ void mSTATs()
 
   if(__malloc_initialized < 0)
     ptmalloc_init ();
+#ifdef _LIBC
+  _IO_flockfile (stderr);
+  int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+  ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+#endif
   for (i=0, ar_ptr = &main_arena;; i++) {
     (void)mutex_lock(&ar_ptr->mutex);
     mi = mALLINFo(ar_ptr);
@@ -5152,6 +5168,10 @@ void mSTATs()
   fprintf(stderr, "locked total     = %10ld\n",
           stat_lock_direct + stat_lock_loop + stat_lock_wait);
 #endif
+#ifdef _LIBC
+  ((_IO_FILE *) stderr)->_flags2 |= old_flags2;
+  _IO_funlockfile (stderr);
+#endif
 }
 
 
diff --git a/misc/Makefile b/misc/Makefile
index db04bb9baf..12d48432a8 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -88,6 +88,7 @@ CFLAGS-mkstemp.c = -fexceptions
 CFLAGS-mkstemp64.c = -fexceptions
 CFLAGS-getsysstats.c = -fexceptions
 CFLAGS-getusershell.c = -fexceptions
+CFLAGS-err.c = -fexceptions
 
 include ../Rules
 
diff --git a/misc/err.h b/misc/err.h
index 9791a659c6..7ff3553ab3 100644
--- a/misc/err.h
+++ b/misc/err.h
@@ -1,5 +1,5 @@
 /* 4.4BSD utility functions for error messages.
-   Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1995,1996,1997,1998,1999,2003 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
@@ -33,25 +33,25 @@ __BEGIN_DECLS
 /* Print "program: ", FORMAT, ": ", the standard error string for errno,
    and a newline, on stderr.  */
 extern void warn (__const char *__format, ...)
-     __THROW __attribute__ ((__format__ (__printf__, 1, 2)));
+     __attribute__ ((__format__ (__printf__, 1, 2)));
 extern void vwarn (__const char *__format, __gnuc_va_list)
-     __THROW __attribute__ ((__format__ (__printf__, 1, 0)));
+     __attribute__ ((__format__ (__printf__, 1, 0)));
 
 /* Likewise, but without ": " and the standard error string.  */
 extern void warnx (__const char *__format, ...)
-     __THROW __attribute__ ((__format__ (__printf__, 1, 2)));
+     __attribute__ ((__format__ (__printf__, 1, 2)));
 extern void vwarnx (__const char *__format, __gnuc_va_list)
-     __THROW __attribute__ ((__format__ (__printf__, 1, 0)));
+     __attribute__ ((__format__ (__printf__, 1, 0)));
 
 /* Likewise, and then exit with STATUS.  */
 extern void err (int __status, __const char *__format, ...)
-     __THROW __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
+     __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
 extern void verr (int __status, __const char *__format, __gnuc_va_list)
-     __THROW __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
+     __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
 extern void errx (int __status, __const char *__format, ...)
-     __THROW __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
+     __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
 extern void verrx (int __status, __const char *, __gnuc_va_list)
-     __THROW __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
+     __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
 
 __END_DECLS
 
diff --git a/posix/Makefile b/posix/Makefile
index ede637aa39..1640e3ee4b 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -118,7 +118,7 @@ endif
 endif
 
 CFLAGS-regex.c = -Wno-strict-prototypes
-CFLAGS-getaddrinfo.c = -DRESOLVER
+CFLAGS-getaddrinfo.c = -DRESOLVER -fexceptions
 CFLAGS-pread.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-pread64.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-pwrite.c = -fexceptions -fasynchronous-unwind-tables
@@ -132,6 +132,12 @@ CFLAGS-wordexp.c = -fexceptions
 CFLAGS-sysconf.c = -fexceptions
 CFLAGS-pathconf.c = -fexceptions
 CFLAGS-fpathconf.c = -fexceptions
+CFLAGS-spawn.c = -fexceptions
+CFLAGS-spawnp.c = -fexceptions
+CFLAGS-spawni.c = -fexceptions
+CFLAGS-pause.c = -fexceptions
+CFLAGS-glob.c = -fexceptions
+CFLAGS-glob64.c = -fexceptions
 
 tstgetopt-ARGS = -a -b -cfoobar --required foobar --optional=bazbug \
 		--none random --col --color --colour
diff --git a/posix/getopt.c b/posix/getopt.c
index 289d137e20..5336410eed 100644
--- a/posix/getopt.c
+++ b/posix/getopt.c
@@ -2,7 +2,7 @@
    NOTE: getopt is now part of the C library, so if you don't know what
    "Keep this file name-space clean" means, talk to drepper@gnu.org
    before changing it!
-   Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002
+   Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003
    	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -692,12 +692,19 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
 	      if (__asprintf (&buf, _("%s: option `%s' is ambiguous\n"),
 			      argv[0], argv[optind]) >= 0)
 		{
+		  _IO_flockfile (stderr);
+
+		  int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+		  ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
 
 		  if (_IO_fwide (stderr, 0) > 0)
 		    __fwprintf (stderr, L"%s", buf);
 		  else
 		    fputs (buf, stderr);
 
+		  ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+		  _IO_funlockfile (stderr);
+
 		  free (buf);
 		}
 #else
@@ -761,11 +768,20 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
 #if defined _LIBC && defined USE_IN_LIBIO
 		      if (n >= 0)
 			{
+			  _IO_flockfile (stderr);
+
+			  int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+			  ((_IO_FILE *) stderr)->_flags2
+			    |= _IO_FLAGS2_NOTCANCEL;
+
 			  if (_IO_fwide (stderr, 0) > 0)
 			    __fwprintf (stderr, L"%s", buf);
 			  else
 			    fputs (buf, stderr);
 
+			  ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+			  _IO_funlockfile (stderr);
+
 			  free (buf);
 			}
 #endif
@@ -792,11 +808,20 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
 %s: option `%s' requires an argument\n"),
 				      argv[0], argv[optind - 1]) >= 0)
 			{
+			  _IO_flockfile (stderr);
+
+			  int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+			  ((_IO_FILE *) stderr)->_flags2
+			    |= _IO_FLAGS2_NOTCANCEL;
+
 			  if (_IO_fwide (stderr, 0) > 0)
 			    __fwprintf (stderr, L"%s", buf);
 			  else
 			    fputs (buf, stderr);
 
+			  ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+			  _IO_funlockfile (stderr);
+
 			  free (buf);
 			}
 #else
@@ -861,11 +886,19 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
 #if defined _LIBC && defined USE_IN_LIBIO
 	      if (n >= 0)
 		{
+		  _IO_flockfile (stderr);
+
+		  int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+		  ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+
 		  if (_IO_fwide (stderr, 0) > 0)
 		    __fwprintf (stderr, L"%s", buf);
 		  else
 		    fputs (buf, stderr);
 
+		  ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+		  _IO_funlockfile (stderr);
+
 		  free (buf);
 		}
 #endif
@@ -919,11 +952,19 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
 #if defined _LIBC && defined USE_IN_LIBIO
 	    if (n >= 0)
 	      {
+		_IO_flockfile (stderr);
+
+		int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+		((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+
 		if (_IO_fwide (stderr, 0) > 0)
 		  __fwprintf (stderr, L"%s", buf);
 		else
 		  fputs (buf, stderr);
 
+		((_IO_FILE *) stderr)->_flags2 = old_flags2;
+		_IO_funlockfile (stderr);
+
 		free (buf);
 	      }
 #endif
@@ -962,11 +1003,19 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
 				_("%s: option requires an argument -- %c\n"),
 				argv[0], c) >= 0)
 		  {
+		    _IO_flockfile (stderr);
+
+		    int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+		    ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+
 		    if (_IO_fwide (stderr, 0) > 0)
 		      __fwprintf (stderr, L"%s", buf);
 		    else
 		      fputs (buf, stderr);
 
+		    ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+		    _IO_funlockfile (stderr);
+
 		    free (buf);
 		  }
 #else
@@ -1025,11 +1074,19 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
 		if (__asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"),
 				argv[0], argv[optind]) >= 0)
 		  {
+		    _IO_flockfile (stderr);
+
+		    int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+		    ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+
 		    if (_IO_fwide (stderr, 0) > 0)
 		      __fwprintf (stderr, L"%s", buf);
 		    else
 		      fputs (buf, stderr);
 
+		    ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+		    _IO_funlockfile (stderr);
+
 		    free (buf);
 		  }
 #else
@@ -1061,11 +1118,20 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
 %s: option `-W %s' doesn't allow an argument\n"),
 					argv[0], pfound->name) >= 0)
 			  {
+			    _IO_flockfile (stderr);
+
+			    int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+			    ((_IO_FILE *) stderr)->_flags2
+			      |= _IO_FLAGS2_NOTCANCEL;
+
 			    if (_IO_fwide (stderr, 0) > 0)
 			      __fwprintf (stderr, L"%s", buf);
 			    else
 			      fputs (buf, stderr);
 
+			    ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+			    _IO_funlockfile (stderr);
+
 			    free (buf);
 			  }
 #else
@@ -1094,11 +1160,20 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
 %s: option `%s' requires an argument\n"),
 					argv[0], argv[optind - 1]) >= 0)
 			  {
+			    _IO_flockfile (stderr);
+
+			    int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+			    ((_IO_FILE *) stderr)->_flags2
+			      |= _IO_FLAGS2_NOTCANCEL;
+
 			    if (_IO_fwide (stderr, 0) > 0)
 			      __fwprintf (stderr, L"%s", buf);
 			    else
 			      fputs (buf, stderr);
 
+			    ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+			    _IO_funlockfile (stderr);
+
 			    free (buf);
 			  }
 #else
@@ -1160,11 +1235,19 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
 %s: option requires an argument -- %c\n"),
 				    argv[0], c) >= 0)
 		      {
+			_IO_flockfile (stderr);
+
+			int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+			((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+
 			if (_IO_fwide (stderr, 0) > 0)
 			  __fwprintf (stderr, L"%s", buf);
 			else
 			  fputs (buf, stderr);
 
+			((_IO_FILE *) stderr)->_flags2 = old_flags2;
+			_IO_funlockfile (stderr);
+
 			free (buf);
 		      }
 #else
diff --git a/posix/getopt.h b/posix/getopt.h
index 4283c35b16..53cb2baaf0 100644
--- a/posix/getopt.h
+++ b/posix/getopt.h
@@ -1,5 +1,5 @@
 /* Declarations for getopt.
-   Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1989-1994, 1996-1999,2001,2003 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
@@ -34,6 +34,14 @@
 # include <ctype.h>
 #endif
 
+#ifndef __THROW
+# if defined __cplusplus && __GNUC_PREREQ (2,8)
+#  define __THROW	throw ()
+# else
+#  define __THROW
+# endif
+#endif
+
 #ifdef	__cplusplus
 extern "C" {
 #endif
@@ -142,7 +150,8 @@ struct option
 /* Many other libraries have conflicting prototypes for getopt, with
    differences in the consts, in stdlib.h.  To avoid compilation
    errors, only prototype getopt for the GNU C library.  */
-extern int getopt (int ___argc, char *const *___argv, const char *__shortopts);
+extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
+       __THROW;
 # else /* not __GNU_LIBRARY__ */
 extern int getopt ();
 # endif /* __GNU_LIBRARY__ */
@@ -150,10 +159,12 @@ extern int getopt ();
 # ifndef __need_getopt
 extern int getopt_long (int ___argc, char *const *___argv,
 			const char *__shortopts,
-		        const struct option *__longopts, int *__longind);
+		        const struct option *__longopts, int *__longind)
+       __THROW;
 extern int getopt_long_only (int ___argc, char *const *___argv,
 			     const char *__shortopts,
-		             const struct option *__longopts, int *__longind);
+		             const struct option *__longopts, int *__longind)
+       __THROW;
 
 /* Internal only.  Users should not call this directly.  */
 extern int _getopt_internal (int ___argc, char *const *___argv,
diff --git a/pwd/Makefile b/pwd/Makefile
index f656022ae2..5b3053676e 100644
--- a/pwd/Makefile
+++ b/pwd/Makefile
@@ -36,6 +36,7 @@ CFLAGS-getpwuid_r.c = -DUSE_NSCD=1
 CFLAGS-getpwnam_r.c = -DUSE_NSCD=1
 CFLAGS-getpwent_r.c = -fexceptions
 CFLAGS-getpwent.c = -fexceptions
+CFLAGS-getpw.c = -fexceptions
 
 endif
 
diff --git a/resolv/herror.c b/resolv/herror.c
index 11a6a5ee69..a61a3a9a4d 100644
--- a/resolv/herror.c
+++ b/resolv/herror.c
@@ -62,6 +62,7 @@ static const char rcsid[] = "$BINDId: herror.c,v 8.11 1999/10/13 16:39:39 vixie
 #include <unistd.h>
 
 #include <libintl.h>
+#include <not-cancel.h>
 
 const char *h_errlist[] = {
 	N_("Resolver Error 0 (no error)"),
@@ -94,7 +95,7 @@ herror(const char *s) {
 	v++;
 	v->iov_base = "\n";
 	v->iov_len = 1;
-	__writev(STDERR_FILENO, iov, (v - iov) + 1);
+	writev_not_cancel_no_status(STDERR_FILENO, iov, (v - iov) + 1);
 }
 
 /*
diff --git a/shadow/Makefile b/shadow/Makefile
index bea9c7f691..c52c59db54 100644
--- a/shadow/Makefile
+++ b/shadow/Makefile
@@ -28,5 +28,10 @@ routines	= getspent getspnam sgetspent fgetspent putspent \
 
 CFLAGS-getspent_r.c = -fexceptions
 CFLAGS-getspent.c = -fexceptions
+CFLAGS-fgetspent.c = -fexceptions
+CFLAGS-fgetspent_r.c = -fexceptions
+CFLAGS-putspent.c = -fexceptions
+CFLAGS-getspnam.c = -fexceptions
+CFLAGS-getspnam_r.c = -fexceptions
 
 include ../Rules
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index 5c2d1bb33a..7b12089e35 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -86,6 +86,7 @@ CFLAGS-tmpfile64.c = -fexceptions
 CFLAGS-tempname.c = -fexceptions
 CFLAGS-psignal.c = -fexceptions
 CFLAGS-vprintf.c = -fexceptions
+CFLAGS-cuserid.c = -fexceptions
 
 tst-sscanf-ENV = LOCPATH=$(common-objpfx)localedata
 tst-swprintf-ENV = LOCPATH=$(common-objpfx)localedata
diff --git a/stdio-common/stdio_ext.h b/stdio-common/stdio_ext.h
index 55586ea841..23d12e0921 100644
--- a/stdio-common/stdio_ext.h
+++ b/stdio-common/stdio_ext.h
@@ -1,5 +1,5 @@
 /* Functions to access FILE structure internals.
-   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2003 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
@@ -44,43 +44,43 @@ __BEGIN_DECLS
 
 /* Return the size of the buffer of FP in bytes currently in use by
    the given stream.  */
-extern size_t __fbufsize (FILE *__fp);
+extern size_t __fbufsize (FILE *__fp) __THROW;
 
 
 /* Return non-zero value iff the stream FP is opened readonly, or if the
    last operation on the stream was a read operation.  */
-extern int __freading (FILE *__fp);
+extern int __freading (FILE *__fp) __THROW;
 
 /* Return non-zero value iff the stream FP is opened write-only or
    append-only, or if the last operation on the stream was a write
    operation.  */
-extern int __fwriting (FILE *__fp);
+extern int __fwriting (FILE *__fp) __THROW;
 
 
 /* Return non-zero value iff stream FP is not opened write-only or
    append-only.  */
-extern int __freadable (FILE *__fp);
+extern int __freadable (FILE *__fp) __THROW;
 
 /* Return non-zero value iff stream FP is not opened read-only.  */
-extern int __fwritable (FILE *__fp);
+extern int __fwritable (FILE *__fp) __THROW;
 
 
 /* Return non-zero value iff the stream FP is line-buffered.  */
-extern int __flbf (FILE *__fp);
+extern int __flbf (FILE *__fp) __THROW;
 
 
 /* Discard all pending buffered I/O on the stream FP.  */
-extern void __fpurge (FILE *__fp);
+extern void __fpurge (FILE *__fp) __THROW;
 
 /* Return amount of output in bytes pending on a stream FP.  */
-extern size_t __fpending (FILE *__fp);
+extern size_t __fpending (FILE *__fp) __THROW;
 
 /* Flush all line-buffered files.  */
 extern void _flushlbf (void);
 
 
 /* Set locking status of stream FP to TYPE.  */
-extern int __fsetlocking (FILE *__fp, int __type);
+extern int __fsetlocking (FILE *__fp, int __type) __THROW;
 
 __END_DECLS
 
diff --git a/stdlib/Makefile b/stdlib/Makefile
index 21490703f7..9b74c6febc 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -83,7 +83,6 @@ CFLAGS-bsearch.c = $(exceptions)
 CFLAGS-msort.c = $(exceptions)
 CFLAGS-qsort.c = $(exceptions)
 CFLAGS-system.c = -fexceptions
-CFLAGS-mkstemp.c = -fexceptions
 CFLAGS-fmtmsg.c = -fexceptions
 
 include ../Makeconfig
diff --git a/sunrpc/Makefile b/sunrpc/Makefile
index 2a45f049ca..6431324f3e 100644
--- a/sunrpc/Makefile
+++ b/sunrpc/Makefile
@@ -122,6 +122,7 @@ CFLAGS-auth_unix.c = -fexceptions
 CFLAGS-key_call.c = -fexceptions
 CFLAGS-pmap_rmt.c = -fexceptions
 CFLAGS-clnt_perr.c = -fexceptions
+CFLAGS-openchild.c = -fexceptions
 
 ifeq (yes,$(have_doors))
 CPPFLAGS-key_call.c += -DHAVE_DOORS=1