summaryrefslogtreecommitdiffstats
path: root/regress/lib/libpthread/semaphore/sem_trywait/sem_trywait.c
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2012-03-03 09:36:26 +0000
committerguenther <guenther@openbsd.org>2012-03-03 09:36:26 +0000
commitce8a7339e20e3e13b3dadd581f8977d7576826a1 (patch)
tree9bec128e5ce1e7b7c15a78ce644e1bd697903fac /regress/lib/libpthread/semaphore/sem_trywait/sem_trywait.c
parentThe wlmouse offset should be part of the client, not the server. From (diff)
downloadwireguard-openbsd-ce8a7339e20e3e13b3dadd581f8977d7576826a1.tar.xz
wireguard-openbsd-ce8a7339e20e3e13b3dadd581f8977d7576826a1.zip
While we guarantee that a zero-filled sem_t variable will trigger
EINVAL errors, a sem_t on the stack may have garbage, so make the tests portable by moving the sem_t from function to file scope. problem found by miod@
Diffstat (limited to 'regress/lib/libpthread/semaphore/sem_trywait/sem_trywait.c')
-rw-r--r--regress/lib/libpthread/semaphore/sem_trywait/sem_trywait.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/regress/lib/libpthread/semaphore/sem_trywait/sem_trywait.c b/regress/lib/libpthread/semaphore/sem_trywait/sem_trywait.c
index 020c19e283c..b4a4fe64ff6 100644
--- a/regress/lib/libpthread/semaphore/sem_trywait/sem_trywait.c
+++ b/regress/lib/libpthread/semaphore/sem_trywait/sem_trywait.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sem_trywait.c,v 1.1.1.1 2012/01/04 17:36:40 mpi Exp $ */
+/* $OpenBSD: sem_trywait.c,v 1.2 2012/03/03 09:36:26 guenther Exp $ */
/*
* Martin Pieuchot <mpi@openbsd.org>, 2011. Public Domain.
*/
@@ -8,10 +8,11 @@
#include <semaphore.h>
#include "test.h"
+sem_t sem;
+
int
main(int argc, char **argv)
{
- sem_t sem;
int val;
CHECKn(sem_trywait(&sem));