diff options
author | Andreas Schwab <schwab@redhat.com> | 2009-11-02 16:15:53 +0100 |
---|---|---|
committer | Andreas Schwab <schwab@redhat.com> | 2009-11-02 16:15:53 +0100 |
commit | 4ed68fe3da53b4f0bfca9b20a93f01d1367e9c85 (patch) | |
tree | 572fc6a1d56706865e1063c673b1b848bf5e759e /nptl | |
parent | 74bad6a85652af19a81aed13ec3409f89eec602e (diff) | |
parent | 7f9cd6ed20b12435e68153870cee5adbe09c4bca (diff) |
Merge commit 'glibc-2.11' into fedora/master
Diffstat (limited to 'nptl')
-rw-r--r-- | nptl/ChangeLog | 2 | ||||
-rw-r--r-- | nptl/tst-sem11.c | 18 |
2 files changed, 12 insertions, 8 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 4d0ca8035a..f11a47dd0b 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,5 +1,7 @@ 2009-10-30 Ulrich Drepper <drepper@redhat.com> + * tst-sem11.c (main): Rewrite to avoid aliasing problems. + [BZ #3270] * allocatestack.c (__nptl_setxid): Perform the operation in multiple steps to avoid races with creation and terminations. diff --git a/nptl/tst-sem11.c b/nptl/tst-sem11.c index 6633ddd1f3..5248eba05d 100644 --- a/nptl/tst-sem11.c +++ b/nptl/tst-sem11.c @@ -23,23 +23,25 @@ main (void) { int tries = 5; pthread_t th; - sem_t s; + union + { + sem_t s; + struct new_sem ns; + } u; again: - if (sem_init (&s, 0, 0) != 0) + if (sem_init (&u.s, 0, 0) != 0) { puts ("sem_init failed"); return 1; } - struct new_sem *is = (struct new_sem *) &s; - - if (is->nwaiters != 0) + if (u.ns.nwaiters != 0) { puts ("nwaiters not initialized"); return 1; } - if (pthread_create (&th, NULL, tf, &s) != 0) + if (pthread_create (&th, NULL, tf, &u.s) != 0) { puts ("pthread_create failed"); return 1; @@ -62,11 +64,11 @@ main (void) if (r != PTHREAD_CANCELED && --tries > 0) { /* Maybe we get the scheduling right the next time. */ - sem_destroy (&s); + sem_destroy (&u.s); goto again; } - if (is->nwaiters != 0) + if (u.ns.nwaiters != 0) { puts ("nwaiters not reset"); return 1; |