diff options
author | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2005-10-30 23:59:44 +0000 |
---|---|---|
committer | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2005-10-30 23:59:44 +0000 |
commit | cb67519b77a103b61c3bbb7ce5c75ed47f806594 (patch) | |
tree | 63f0965918ab8c1a74127050d38ff6a9cf0389d3 /regress | |
parent | 3db6420a0dd659f095653164cbe7548e15cba677 (diff) |
-Wall cleanup.
Diffstat (limited to 'regress')
-rw-r--r-- | regress/lib/libpthread/group/group.c | 14 | ||||
-rw-r--r-- | regress/lib/libpthread/pthread_mutex/pthread_mutex.c | 5 | ||||
-rw-r--r-- | regress/lib/libpthread/socket/2/socket2.c | 4 | ||||
-rw-r--r-- | regress/lib/libpthread/socket/3/socket3.c | 6 |
4 files changed, 19 insertions, 10 deletions
diff --git a/regress/lib/libpthread/group/group.c b/regress/lib/libpthread/group/group.c index 5f6a8793f64..6fade5de422 100644 --- a/regress/lib/libpthread/group/group.c +++ b/regress/lib/libpthread/group/group.c @@ -1,4 +1,4 @@ -/* $OpenBSD: group.c,v 1.5 2003/07/31 21:48:04 deraadt Exp $ */ +/* $OpenBSD: group.c,v 1.6 2005/10/30 23:59:43 fgsch Exp $ */ /* David Leonard <d@openbsd.org>, 2001. Public Domain. */ @@ -40,6 +40,7 @@ test(void *arg) char *s; char *oname; char *opasswd; + size_t len; /* Acquire lock for running first part. */ CHECKr(pthread_mutex_lock(&display)); @@ -58,13 +59,16 @@ test(void *arg) ASSERT(grp->gr_gid == gid); s = buf; /* Keep our private buffer on the stack */ + len = sizeof(buf); /* copy gr_name */ - strcpy(oname = s, grp->gr_name); + strlcpy(oname = s, grp->gr_name, len); + len -= 1 + strlen(s); s += 1 + strlen(s); /* copy gr_passwd */ - strcpy(opasswd = s, grp->gr_passwd); + strlcpy(opasswd = s, grp->gr_passwd, len); + len -= 1 + strlen(s); s += 1 + strlen(s); /* copy gr_gid */ @@ -72,7 +76,9 @@ test(void *arg) /* copy gr_mem */ for (i = 0, p = grp->gr_mem; *p; p++) { - strcpy(cpy[i] = s, *p); i++; + strlcpy(cpy[i] = s, *p, len); + i++; + len -= 1 + strlen(s); s += 1 + strlen(s); } cpy[i] = NULL; diff --git a/regress/lib/libpthread/pthread_mutex/pthread_mutex.c b/regress/lib/libpthread/pthread_mutex/pthread_mutex.c index c534479b7fc..98121236acc 100644 --- a/regress/lib/libpthread/pthread_mutex/pthread_mutex.c +++ b/regress/lib/libpthread/pthread_mutex/pthread_mutex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pthread_mutex.c,v 1.4 2003/07/31 21:48:05 deraadt Exp $ */ +/* $OpenBSD: pthread_mutex.c,v 1.5 2005/10/30 23:59:43 fgsch Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors, * proven@mit.edu All rights reserved. @@ -122,6 +122,7 @@ test_mutex_static(void) printf("test_mutex_static()\n"); test_nocontention_lock(&mutex_static); + test_nocontention_trylock(&mutex_static); test_contention_lock(&mutex_static); } @@ -133,6 +134,7 @@ test_mutex_fast(void) printf("test_mutex_fast()\n"); CHECKr(pthread_mutex_init(&mutex_fast, NULL)); test_nocontention_lock(&mutex_fast); + test_nocontention_trylock(&mutex_fast); test_contention_lock(&mutex_fast); CHECKr(pthread_mutex_destroy(&mutex_fast)); } @@ -149,6 +151,7 @@ test_mutex_debug(void) PTHREAD_MUTEX_ERRORCHECK)); CHECKr(pthread_mutex_init(&mutex_debug, &mutex_debug_attr)); test_nocontention_lock(&mutex_debug); + test_nocontention_trylock(&mutex_debug); test_contention_lock(&mutex_debug); test_debug_double_lock(&mutex_debug); test_debug_double_unlock(&mutex_debug); diff --git a/regress/lib/libpthread/socket/2/socket2.c b/regress/lib/libpthread/socket/2/socket2.c index 5b53937662b..78ca83da110 100644 --- a/regress/lib/libpthread/socket/2/socket2.c +++ b/regress/lib/libpthread/socket/2/socket2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: socket2.c,v 1.5 2004/02/28 08:06:47 deraadt Exp $ */ +/* $OpenBSD: socket2.c,v 1.6 2005/10/30 23:59:43 fgsch Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors, * proven@mit.edu All rights reserved. @@ -72,7 +72,7 @@ sock_write(void *arg) static pthread_mutex_t waiter_mutex = PTHREAD_MUTEX_INITIALIZER; static void * -waiter(int sig) +waiter(void *arg) { int status; pid_t pid; diff --git a/regress/lib/libpthread/socket/3/socket3.c b/regress/lib/libpthread/socket/3/socket3.c index 6df2e25f2a6..241489b263f 100644 --- a/regress/lib/libpthread/socket/3/socket3.c +++ b/regress/lib/libpthread/socket/3/socket3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: socket3.c,v 1.3 2003/07/31 21:48:06 deraadt Exp $ */ +/* $OpenBSD: socket3.c,v 1.4 2005/10/30 23:59:43 fgsch Exp $ */ /* PUBLIC DOMAIN Oct 2002 <marc@snafu.org> */ /* Test blocking/non-blocking mode inheritance on accept */ @@ -28,7 +28,7 @@ sock_connect(void *arg) int sock; SET_NAME("connect"); - port = (int)arg; + port = *(int *)arg; CHECKe(sock = socket(AF_INET, SOCK_STREAM, 0)); sin.sin_family = AF_INET; sin.sin_port = htons(port); @@ -80,7 +80,7 @@ sock_accept(void *arg) /* Create another thread to connect to the listening socket. */ CHECKr(pthread_create(&connect_thread, NULL, sock_connect, - (void*)port)); + (void *)&port)); /* * Use poll to check for a pending connection as the socket |