Update.
authorUlrich Drepper <drepper@redhat.com>
Sat, 30 Aug 2003 09:10:12 +0000 (09:10 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sat, 30 Aug 2003 09:10:12 +0000 (09:10 +0000)
* misc/Makefile (CFLAGS-getpass.c): Add -fexceptions.
* misc/getpass.c (getpass): Add cleanup handler to ensure the
stream is closed even if the thread is canceled.
(call_fclose): New function.
* posix/unistd.h: Remove __THROW from getpass prorotype.

* posix/Makefile (CFLAGS-getopt.c): Add -fexceptions.

* signal/signal.h (psignal): Remove __THROW.
* stdio-common/Makefile (CFLAGS-psignal.c): Add -fexceptions.

ChangeLog
misc/Makefile
misc/getpass.c
posix/Makefile
posix/unistd.h
signal/signal.h
stdio-common/Makefile

index 2a68990..9f41fa5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2003-08-30  Ulrich Drepper  <drepper@redhat.com>
 
+       * misc/Makefile (CFLAGS-getpass.c): Add -fexceptions.
+       * misc/getpass.c (getpass): Add cleanup handler to ensure the
+       stream is closed even if the thread is canceled.
+       (call_fclose): New function.
+       * posix/unistd.h: Remove __THROW from getpass prorotype.
+
+       * posix/Makefile (CFLAGS-getopt.c): Add -fexceptions.
+
+       * signal/signal.h (psignal): Remove __THROW.
+       * stdio-common/Makefile (CFLAGS-psignal.c): Add -fexceptions.
+
        * misc/Makefile (CFLAGS-error.c): Define.
        * misc/error.c (error): Disable cancellation handling around the
        actual output.  The message should in any case be printed.
index 570ff08..5c93e43 100644 (file)
@@ -83,6 +83,7 @@ CFLAGS-writev.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-usleep.c = -fexceptions
 CFLAGS-syslog.c = -fexceptions
 CFLAGS-error.c = -fexceptions
+CFLAGS-getpass.c = -fexceptions
 
 include ../Rules
 
index e5483f9..70562e5 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992,93,94,95,96,97,98,99,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1992-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
 #include <termios.h>
 #include <unistd.h>
 
-#ifdef USE_IN_LIBIO
-# include <wchar.h>
-# define flockfile(s) _IO_flockfile (s)
-# define funlockfile(s) _IO_funlockfile (s)
-#endif
+#include <wchar.h>
+#define flockfile(s) _IO_flockfile (s)
+#define funlockfile(s) _IO_funlockfile (s)
+#include <bits/libc-lock.h>
 
 /* It is desirable to use this bit on systems that have it.
    The only bit of terminal state we want to twiddle is echoing, which is
 #define TCSASOFT 0
 #endif
 
+static void
+call_fclose (void *arg)
+{
+  if (arg != NULL)
+    fclose (arg);
+}
+
 char *
 getpass (prompt)
      const char *prompt;
@@ -64,6 +70,10 @@ getpass (prompt)
       out = in;
     }
 
+  /* Make sure the stream we opened is closed even if the thread is
+     canceled.  */
+  __libc_cleanup_push (call_fclose, in == out ? in : NULL);
+
   flockfile (out);
 
   /* Turn echoing off if it is on now.  */
@@ -117,6 +127,8 @@ getpass (prompt)
 
   funlockfile (out);
 
+  __libc_cleanup_pop (0);
+
   if (in != stdin)
     /* We opened the terminal; now close it.  */
     fclose (in);
index d8516c2..c617612 100644 (file)
@@ -127,6 +127,7 @@ CFLAGS-sleep.c = -fexceptions
 CFLAGS-wait.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-waitid.c = -fexceptions
 CFLAGS-waitpid.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-getopt.c = -fexceptions
 
 tstgetopt-ARGS = -a -b -cfoobar --required foobar --optional=bazbug \
                --none random --col --color --colour
index 1e28ba2..4a7be1c 100644 (file)
@@ -845,7 +845,7 @@ extern int chroot (__const char *__path) __THROW;
 
 /* Prompt with PROMPT and read a string from the terminal without echoing.
    Uses /dev/tty if possible; otherwise stderr and stdin.  */
-extern char *getpass (__const char *__prompt) __THROW;
+extern char *getpass (__const char *__prompt);
 #endif /* Use BSD || X/Open.  */
 
 
index ded9a81..94839b2 100644 (file)
@@ -134,7 +134,7 @@ extern int gsignal (int __sig) __THROW;
 
 #ifdef __USE_MISC
 /* Print a message describing the meaning of the given signal number.  */
-extern void psignal (int __sig, __const char *__s) __THROW;
+extern void psignal (int __sig, __const char *__s);
 #endif /* Use misc.  */
 
 
index ecc6865..b665688 100644 (file)
@@ -84,6 +84,7 @@ CFLAGS-tst-printfsz.c = -Wno-format
 CFLAGS-tmpfile.c = -fexceptions
 CFLAGS-tmpfile64.c = -fexceptions
 CFLAGS-tempname.c = -fexceptions
+CFLAGS-psignal.c = -fexceptions
 
 tst-sscanf-ENV = LOCPATH=$(common-objpfx)localedata
 tst-swprintf-ENV = LOCPATH=$(common-objpfx)localedata