about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2006-09-07 09:04:06 +0000
committerJakub Jelinek <jakub@redhat.com>2006-09-07 09:04:06 +0000
commitbdae5218097f2181710cf9058248e4c549c6ec84 (patch)
tree9d4008aa1d1cbfffbbd2e7525fc0c2630a44cb16
parentfcaea48fef6d82c56461654248e97d0816431d2e (diff)
downloadglibc-bdae5218097f2181710cf9058248e4c549c6ec84.tar.gz
glibc-bdae5218097f2181710cf9058248e4c549c6ec84.tar.xz
glibc-bdae5218097f2181710cf9058248e4c549c6ec84.zip
Updated to fedora-glibc-20060907T0853
-rw-r--r--ChangeLog12
-rw-r--r--fedora/branch.mk4
-rw-r--r--fedora/glibc.spec.in12
-rw-r--r--locale/programs/ld-collate.c5
-rw-r--r--localedata/ChangeLog6
-rw-r--r--localedata/locales/or_IN2
-rw-r--r--nptl/ChangeLog46
-rw-r--r--nptl/Makefile2
-rw-r--r--nptl/descr.h4
-rw-r--r--nptl/pthread_create.c13
-rw-r--r--nptl/sysdeps/pthread/aio_misc.h2
-rw-r--r--nptl/sysdeps/pthread/createthread.c3
-rw-r--r--nptl/sysdeps/pthread/gai_misc.h2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h14
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h14
-rw-r--r--nptl/tst-cancel25.c171
-rw-r--r--nscd/initgrcache.c2
-rw-r--r--resolv/gai_suspend.c1
18 files changed, 279 insertions, 36 deletions
diff --git a/ChangeLog b/ChangeLog
index 0852a3cf5a..8d30040fdc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2006-09-06  Jakub Jelinek  <jakub@redhat.com>
+
+	* locale/programs/ld-collate.c (collate_read): Goto sym_equiv_free
+	rather than col_sym_free.  Move seqp declaration earlier.
+
+	* resolv/gai_suspend.c (gai_suspend): Make sure result is initialized.
+
+2006-09-05  Jakub Jelinek  <jakub@redhat.com>
+
+	* nscd/initgrcache.c (addinitgroupsX): Move any_success
+	decl before first goto out.
+
 2006-09-04  Jakub Jelinek  <jakub@redhat.com>
 
 	* Makerules (shlib.lds): If have-hash-style, put .hash section
diff --git a/fedora/branch.mk b/fedora/branch.mk
index 4de2a2c7fc..989cd3a688 100644
--- a/fedora/branch.mk
+++ b/fedora/branch.mk
@@ -3,5 +3,5 @@ glibc-branch := fedora
 glibc-base := HEAD
 DIST_BRANCH := devel
 COLLECTION := dist-fc4
-fedora-sync-date := 2006-09-05 06:33 UTC
-fedora-sync-tag := fedora-glibc-20060905T0633
+fedora-sync-date := 2006-09-07 08:53 UTC
+fedora-sync-tag := fedora-glibc-20060907T0853
diff --git a/fedora/glibc.spec.in b/fedora/glibc.spec.in
index a4a0230bdc..afdb05b5fa 100644
--- a/fedora/glibc.spec.in
+++ b/fedora/glibc.spec.in
@@ -1,4 +1,4 @@
-%define glibcrelease 29
+%define glibcrelease 30
 %define auxarches i586 i686 athlon sparcv9 alphaev6
 %define xenarches i686 athlon
 %ifarch %{xenarches}
@@ -783,16 +783,16 @@ touch locale/programs/*-kw.h
 GCC=gcc
 GXX=g++
 %ifarch %{ix86}
-BuildFlags="-march=%{_target_cpu} -DUSE_CFA_VAL_EXPRESSION"
+BuildFlags="-march=%{_target_cpu}"
 %endif
 %ifarch i686
-BuildFlags="-march=i686 -mtune=generic -DUSE_CFA_VAL_EXPRESSION"
+BuildFlags="-march=i686 -mtune=generic"
 %endif
 %ifarch i386
 BuildFlags="$BuildFlags -mno-tls-direct-seg-refs"
 %endif
 %ifarch x86_64
-BuildFlags="-mtune=generic -DUSE_CFA_VAL_EXPRESSION"
+BuildFlags="-mtune=generic"
 %endif
 %ifarch alphaev6
 BuildFlags="-mcpu=ev6"
@@ -1448,6 +1448,10 @@ rm -f *.filelist*
 %endif
 
 %changelog
+* Thu Sep  7 2006 Jakub Jelinek <jakub@redhat.com> 2.4.90-30
+- fix or_IN February name (#204730)
+- fix pthread_create called from cancellation handlers (BZ#3124)
+
 * Tue Sep  5 2006 Jakub Jelinek <jakub@redhat.com> 2.4.90-29
 - randomize resolver query ids before use instead after use (#205113)
 - fix resolver symver checking with DT_GNU_HASH (#204909)
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index e69ac85a95..a1401013e0 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -3068,7 +3068,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
 		  lr_error (ldfile, _("\
 %s: unknown symbol `%s' in equivalent definition"),
 			    "LC_COLLATE", symname);
-		  goto col_sym_free;
+		  goto sym_equiv_free;
 		}
 
 	      if (insert_entry (&collate->sym_table,
@@ -3533,13 +3533,13 @@ error while adding equivalent collating symbol"));
 	      break;
 	    }
 
+	  struct element_t *seqp;
 	  if (state == 0)
 	    {
 	      /* We are outside an `order_start' region.  This means
                  we must only accept definitions of values for
                  collation symbols since these are purely abstract
                  values and don't need directions associated.  */
-	      struct element_t *seqp;
 	      void *ptr;
 
 	      if (find_entry (&collate->seq_table, symstr, symlen, &ptr) == 0)
@@ -3586,7 +3586,6 @@ error while adding equivalent collating symbol"));
 	    {
 	      /* It is possible that we already have this collation sequence.
 		 In this case we move the entry.  */
-	      struct element_t *seqp = NULL;
 	      void *sym;
 	      void *ptr;
 
diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index df44366657..936ae8b256 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,3 +1,7 @@
+2006-09-05  Ulrich Drepper  <drepper@redhat.com>
+
+	* locales/or_IN (mon): Fix February string.
+
 2006-08-24  Ulrich Drepper  <drepper@redhat.com>
 
 	[BZ #2695]
@@ -20,7 +24,7 @@
 
 	[BZ #3034]
 	* locales/ml_IN (abmon): Fix June entry.
-	* locales/bn_IN: (abday): Fix Tuesday entry.
+	* locales/bn_IN (abday): Fix Tuesday entry.
 	(day): Likewise.
 	(abmon): Fix January and February entries.
 	(mon): Likewise.
diff --git a/localedata/locales/or_IN b/localedata/locales/or_IN
index 03123026d5..86754b2e2f 100644
--- a/localedata/locales/or_IN
+++ b/localedata/locales/or_IN
@@ -641,7 +641,7 @@ abmon   "<U0031>";/
         "<U0031><U0031>";/
         "<U0031><U0032>"
 mon     "<U0B1C><U0B3E><U0B28><U0B41><U0B06><U0B30><U0B40>";/
-        "<U0B2B><U0B47><U0B2C><U0B4D><U0B30><U0B41><U0B5F><U0B3E><U0B30><U0B40>";/
+	"<U0B2B><U0B47><U0B2C><U0B43><U0B06><U0B30><U0B40>";/
         "<U0B2E><U0B3E><U0B30><U0B4D><U0B1A><U0B4D><U0B1A>";/
         "<U0B05><U0B2A><U0B4D><U0B30><U0B47><U0B32>";/
         "<U0B2E><U0B07>";/
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 4e3bf38bfd..1d89bfa396 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,49 @@
+2006-09-05  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #3124]
+	* descr.h (struct pthread): Add parent_cancelhandling.
+	* sysdeps/pthread/createthread.c (create_thread): Pass parent
+	cancelhandling value to child.
+	* pthread_create.c (start_thread): If parent thread was canceled
+	reset the SIGCANCEL mask.
+	* Makefile (tests): Add tst-cancel25.
+	* tst-cancel25.c: New file.
+
+2006-09-05  Jakub Jelinek  <jakub@redhat.com>
+            Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/pthread/gai_misc.h (GAI_MISC_NOTIFY): Don't decrement
+	counterp if it is already zero.
+	* sysdeps/pthread/aio_misc.h (AIO_MISC_NOTIFY): Likewise..
+
+2006-03-04  Jakub Jelinek  <jakub@redhat.com>
+            Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/unix/sysv/linux/i386/lowlevellock.h
+	(LLL_STUB_UNWIND_INFO_START, LLL_STUB_UNWIND_INFO_END,
+	LLL_STUB_UNWIND_INFO_3, LLL_STUB_UNWIND_INFO_4): Define.
+	(lll_mutex_lock, lll_robust_mutex_lock, lll_mutex_cond_lock,
+	lll_robust_mutex_cond_lock, lll_mutex_timedlock,
+	lll_robust_mutex_timedlock, lll_mutex_unlock,
+	lll_robust_mutex_unlock, lll_lock, lll_unlock): Use them.
+	Add _L_*_ symbols around the subsection.
+	* sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S: Add unwind info.
+	* sysdeps/unix/sysv/linux/i386/i486/lowlevelrobustlock.S: Likewise.
+
+2006-03-03  Jakub Jelinek  <jakub@redhat.com>
+            Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
+	(LLL_STUB_UNWIND_INFO_START, LLL_STUB_UNWIND_INFO_END,
+	LLL_STUB_UNWIND_INFO_5, LLL_STUB_UNWIND_INFO_6): Define.
+	(lll_mutex_lock, lll_robust_mutex_lock, lll_mutex_cond_lock,
+	lll_robust_mutex_cond_lock, lll_mutex_timedlock,
+	lll_robust_mutex_timedlock, lll_mutex_unlock,
+	lll_robust_mutex_unlock, lll_lock, lll_unlock): Use them.
+	Add _L_*_ symbols around the subsection.
+	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Add unwind info.
+	* sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S: Likewise.
+
 2006-08-31  Ulrich Drepper  <drepper@redhat.com>
 
 	* pthread_rwlock_trywrlock.c (__pthread_rwlock_trywrlock): Undo last
diff --git a/nptl/Makefile b/nptl/Makefile
index 74a834d64d..e907ca0c3a 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -235,7 +235,7 @@ tests = tst-typesizes \
 	tst-cancel6 tst-cancel7 tst-cancel8 tst-cancel9 tst-cancel10 \
 	tst-cancel11 tst-cancel12 tst-cancel13 tst-cancel14 tst-cancel15 \
 	tst-cancel16 tst-cancel17 tst-cancel18 tst-cancel19 tst-cancel20 \
-	tst-cancel21 tst-cancel22 tst-cancel23 tst-cancel24 \
+	tst-cancel21 tst-cancel22 tst-cancel23 tst-cancel24 tst-cancel25 \
 	tst-cleanup0 tst-cleanup1 tst-cleanup2 tst-cleanup3 tst-cleanup4 \
 	tst-flock1 tst-flock2 \
 	tst-signal1 tst-signal2 tst-signal3 tst-signal4 tst-signal5 \
diff --git a/nptl/descr.h b/nptl/descr.h
index 7acd2f4f22..b9b9ed7b98 100644
--- a/nptl/descr.h
+++ b/nptl/descr.h
@@ -296,6 +296,10 @@ struct pthread
   /* True if thread must stop at startup time.  */
   bool stopped_start;
 
+  /* The parent's cancel handling at the time of the pthread_create
+     call.  This might be needed to undo the effects of a cancellation.  */
+  int parent_cancelhandling;
+
   /* Lock to synchronize access to the descriptor.  */
   lll_lock_t lock;
 
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index 315722643b..79729ced03 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -251,6 +251,19 @@ start_thread (void *arg)
     }
 #endif
 
+  /* If the parent was running cancellation handlers while creating
+     the thread the new thread inherited the signal mask.  Reset the
+     cancellation signal mask.  */
+  if (__builtin_expect (pd->parent_cancelhandling & CANCELING_BITMASK, 0))
+    {
+      INTERNAL_SYSCALL_DECL (err);
+      sigset_t mask;
+      __sigemptyset (&mask);
+      __sigaddset (&mask, SIGCANCEL);
+      (void) INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_UNBLOCK, &mask,
+			       NULL, _NSIG / 8);
+    }
+
   /* This is where the try/finally block should be created.  For
      compilers without that support we do use setjmp.  */
   struct pthread_unwind_buf unwind_buf;
diff --git a/nptl/sysdeps/pthread/aio_misc.h b/nptl/sysdeps/pthread/aio_misc.h
index f285083883..c5a11f4550 100644
--- a/nptl/sysdeps/pthread/aio_misc.h
+++ b/nptl/sysdeps/pthread/aio_misc.h
@@ -29,7 +29,7 @@
 
 #define AIO_MISC_NOTIFY(waitlist) \
   do {									      \
-    if (--*waitlist->counterp == 0)					      \
+    if (*waitlist->counterp > 0 && --*waitlist->counterp == 0)		      \
       lll_futex_wake (waitlist->counterp, 1);				      \
   } while (0)
 
diff --git a/nptl/sysdeps/pthread/createthread.c b/nptl/sysdeps/pthread/createthread.c
index 03a0f1aa37..88658a16e1 100644
--- a/nptl/sysdeps/pthread/createthread.c
+++ b/nptl/sysdeps/pthread/createthread.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -242,6 +242,7 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr,
 		       || (attr->flags & ATTR_FLAG_NOTINHERITSCHED) != 0))
     stopped = true;
   pd->stopped_start = stopped;
+  pd->parent_cancelhandling = THREAD_GETMEM (THREAD_SELF, cancelhandling);
 
   /* Actually create the thread.  */
   int res = do_clone (pd, attr, clone_flags, start_thread,
diff --git a/nptl/sysdeps/pthread/gai_misc.h b/nptl/sysdeps/pthread/gai_misc.h
index 1dc351a2de..9f6a73dad1 100644
--- a/nptl/sysdeps/pthread/gai_misc.h
+++ b/nptl/sysdeps/pthread/gai_misc.h
@@ -30,7 +30,7 @@
 
 #define GAI_MISC_NOTIFY(waitlist) \
   do {									      \
-    if (--*waitlist->counterp == 0)					      \
+    if (*waitlist->counterp > 0 && --*waitlist->counterp == 0)		      \
       lll_futex_wake (waitlist->counterp, 1);				      \
   } while (0)
 
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
index 64088ef732..21de09fe91 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
@@ -68,8 +68,7 @@
 #define BUSY_WAIT_NOP          asm ("rep; nop")
 
 
-#ifdef USE_CFA_VAL_EXPRESSION
-# define LLL_STUB_UNWIND_INFO_START \
+#define LLL_STUB_UNWIND_INFO_START \
 	".section	.eh_frame,\"a\",@progbits\n"		\
 "5:\t"	".long	7f-6f	# Length of Common Information Entry\n"	\
 "6:\t"	".long	0x0	# CIE Identifier Tag\n\t"		\
@@ -94,7 +93,7 @@
 	".uleb128 10f-9f\n"					\
 "9:\t"	".byte	0x78	# DW_OP_breg8\n\t"			\
 	".sleb128 3b-1b\n"
-# define LLL_STUB_UNWIND_INFO_END \
+#define LLL_STUB_UNWIND_INFO_END \
 	".byte	0x16	# DW_CFA_val_expression\n\t"		\
 	".uleb128 0x8\n\t"					\
 	".uleb128 12f-11f\n"					\
@@ -121,7 +120,7 @@
    3: jmp 18f
    4:
    snippet.  */
-# define LLL_STUB_UNWIND_INFO_3 \
+#define LLL_STUB_UNWIND_INFO_3 \
 LLL_STUB_UNWIND_INFO_START					\
 "10:\t"	".byte	0x40 + (2b-1b) # DW_CFA_advance_loc\n\t"	\
 LLL_STUB_UNWIND_INFO_END
@@ -133,7 +132,7 @@ LLL_STUB_UNWIND_INFO_END
    3: jmp 18f
    4:
    snippet.  */
-# define LLL_STUB_UNWIND_INFO_4 \
+#define LLL_STUB_UNWIND_INFO_4 \
 LLL_STUB_UNWIND_INFO_START					\
 "10:\t"	".byte	0x40 + (0b-1b) # DW_CFA_advance_loc\n\t"	\
 	".byte	0x16	# DW_CFA_val_expression\n\t"		\
@@ -144,11 +143,6 @@ LLL_STUB_UNWIND_INFO_START					\
 "20:\t"	".byte	0x40 + (2b-0b) # DW_CFA_advance_loc\n\t"	\
 LLL_STUB_UNWIND_INFO_END
 
-#else
-# define LLL_STUB_UNWIND_INFO_3
-# define LLL_STUB_UNWIND_INFO_4
-#endif
-
 
 #define lll_futex_wait(futex, val) \
   ({									      \
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
index 7da2f12231..97085bf018 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
@@ -49,8 +49,7 @@
 #define BUSY_WAIT_NOP          asm ("rep; nop")
 
 
-#ifdef USE_CFA_VAL_EXPRESSION
-# define LLL_STUB_UNWIND_INFO_START \
+#define LLL_STUB_UNWIND_INFO_START \
 	".section	.eh_frame,\"a\",@progbits\n" 		\
 "7:\t"	".long	9f-8f	# Length of Common Information Entry\n" \
 "8:\t"	".long	0x0	# CIE Identifier Tag\n\t" 		\
@@ -75,7 +74,7 @@
 	".uleb128 12f-11f\n" 					\
 "11:\t"	".byte	0x80	# DW_OP_breg16\n\t" 			\
 	".sleb128 4b-1b\n"
-# define LLL_STUB_UNWIND_INFO_END \
+#define LLL_STUB_UNWIND_INFO_END \
 	".byte	0x16	# DW_CFA_val_expression\n\t" 		\
 	".uleb128 0x10\n\t" 					\
 	".uleb128 14f-13f\n" 					\
@@ -122,7 +121,7 @@
    5: jmp 24f
    6:
    snippet.  */
-# define LLL_STUB_UNWIND_INFO_5 \
+#define LLL_STUB_UNWIND_INFO_5 \
 LLL_STUB_UNWIND_INFO_START					\
 "12:\t"	".byte	0x40 + (2b-1b) # DW_CFA_advance_loc\n\t" 	\
 LLL_STUB_UNWIND_INFO_END
@@ -136,7 +135,7 @@ LLL_STUB_UNWIND_INFO_END
    5: jmp 24f
    6:
    snippet.  */
-# define LLL_STUB_UNWIND_INFO_6 \
+#define LLL_STUB_UNWIND_INFO_6 \
 LLL_STUB_UNWIND_INFO_START					\
 "12:\t"	".byte	0x40 + (0b-1b) # DW_CFA_advance_loc\n\t" 	\
 	".byte	0x16	# DW_CFA_val_expression\n\t" 		\
@@ -147,11 +146,6 @@ LLL_STUB_UNWIND_INFO_START					\
 "26:\t"	".byte	0x40 + (2b-0b) # DW_CFA_advance_loc\n\t" 	\
 LLL_STUB_UNWIND_INFO_END
 
-#else
-# define LLL_STUB_UNWIND_INFO_5
-# define LLL_STUB_UNWIND_INFO_6
-#endif
-
 
 #define lll_futex_wait(futex, val) \
   ({									      \
diff --git a/nptl/tst-cancel25.c b/nptl/tst-cancel25.c
new file mode 100644
index 0000000000..00b99ad553
--- /dev/null
+++ b/nptl/tst-cancel25.c
@@ -0,0 +1,171 @@
+#include <pthreadP.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+static pthread_barrier_t b;
+static pthread_t th2;
+
+
+static void *
+tf2 (void *arg)
+{
+  sigset_t mask;
+  if (pthread_sigmask (SIG_SETMASK, NULL, &mask) != 0)
+    {
+      puts ("pthread_sigmask failed");
+      exit (1);
+    }
+  if (sigismember (&mask, SIGCANCEL))
+    {
+      puts ("SIGCANCEL blocked in new thread");
+      exit (1);
+    }
+
+  /* Sync with the main thread so that we do not test anything else.  */
+  int e = pthread_barrier_wait (&b);
+  if (e != 0  && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      exit (1);
+    }
+
+  while (1)
+    {
+      /* Just a cancelable call.  */
+      struct timespec ts = { 10000, 0 };
+      nanosleep (&ts, 0);
+    }
+
+  return NULL;
+}
+
+
+static void
+unwhand (void *arg)
+{
+  if (pthread_create (&th2, NULL, tf2, NULL) != 0)
+    {
+      puts ("unwhand: create failed");
+      exit (1);
+    }
+}
+
+
+static void *
+tf (void *arg)
+{
+  pthread_cleanup_push (unwhand, NULL);
+
+  /* Sync with the main thread so that we do not test anything else.  */
+  int e = pthread_barrier_wait (&b);
+  if (e != 0  && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      exit (1);
+    }
+
+  while (1)
+    {
+      /* Just a cancelable call.  */
+      struct timespec ts = { 10000, 0 };
+      nanosleep (&ts, 0);
+    }
+
+  pthread_cleanup_pop (0);
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
+  pthread_t th1;
+  if (pthread_create (&th1, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      return 1;
+    }
+
+  int e = pthread_barrier_wait (&b);
+  if (e != 0  && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      return 1;
+    }
+
+  /* Make sure tf1 enters nanosleep.  */
+  struct timespec ts = { 0, 500000000 };
+  while (nanosleep (&ts, &ts) != 0)
+    ;
+
+  if (pthread_cancel (th1) != 0)
+    {
+      puts ("1st cancel failed");
+      return 1;
+    }
+
+  void *res;
+  if (pthread_join (th1, &res) != 0)
+    {
+      puts ("1st join failed");
+      return 1;
+    }
+  if (res != PTHREAD_CANCELED)
+    {
+      puts ("1st thread not canceled");
+      return 1;
+    }
+
+  e = pthread_barrier_wait (&b);
+  if (e != 0  && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      return 1;
+    }
+
+  /* Make sure tf2 enters nanosleep.  */
+  ts.tv_sec = 0;
+  ts.tv_nsec = 500000000;
+  while (nanosleep (&ts, &ts) != 0)
+    ;
+
+  puts ("calling pthread_cancel the second time");
+  if (pthread_cancel (th2) != 0)
+    {
+      puts ("2nd cancel failed");
+      return 1;
+    }
+
+  puts ("calling pthread_join the second time");
+  if (pthread_join (th2, &res) != 0)
+    {
+      puts ("2nd join failed");
+      return 1;
+    }
+  if (res != PTHREAD_CANCELED)
+    {
+      puts ("2nd thread not canceled");
+      return 1;
+    }
+
+  if (pthread_barrier_destroy (&b) != 0)
+    {
+      puts ("barrier_destroy failed");
+      return 0;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#define TIMEOUT 4
+#include "../test-skeleton.c"
diff --git a/nscd/initgrcache.c b/nscd/initgrcache.c
index b4ae13903a..f1f859c552 100644
--- a/nscd/initgrcache.c
+++ b/nscd/initgrcache.c
@@ -107,6 +107,7 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
 
   long int start = 0;
   bool all_tryagain = true;
+  bool any_success = false;
 
   /* This is temporary memory, we need not (ad must not) call
      mempool_alloc.  */
@@ -117,7 +118,6 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
     goto out;
 
   /* Nothing added yet.  */
-  bool any_success = false;
   while (! no_more)
     {
       long int prev_start = start;
diff --git a/resolv/gai_suspend.c b/resolv/gai_suspend.c
index c2095124b7..4d85ac2c10 100644
--- a/resolv/gai_suspend.c
+++ b/resolv/gai_suspend.c
@@ -83,6 +83,7 @@ gai_suspend (const struct gaicb *const list[], int ent,
       pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &oldstate);
 
 #ifdef DONT_NEED_GAI_MISC_COND
+      result = 0;
       GAI_MISC_WAIT (result, cntr, timeout, 1);
 #else
       if (timeout == NULL)