summaryrefslogtreecommitdiffstats
path: root/regress/lib/libc/stdio_threading/include
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2014-05-20 01:25:23 +0000
committerguenther <guenther@openbsd.org>2014-05-20 01:25:23 +0000
commit5ad04d351680822078003e2b066cfc9680d6157d (patch)
treebc78d1cc74e659478aa86d8884efcb9a0d678e50 /regress/lib/libc/stdio_threading/include
parentBring UTF8_{getc,putc} up-to-date: it's been a decade since 5- and 6-byte (diff)
downloadwireguard-openbsd-5ad04d351680822078003e2b066cfc9680d6157d.tar.xz
wireguard-openbsd-5ad04d351680822078003e2b066cfc9680d6157d.zip
Use errc/warnc to simplify code.
Also, in 'ftp', always put the error message last, after the hostname/ipaddr. ok jsing@ krw@ millert@
Diffstat (limited to 'regress/lib/libc/stdio_threading/include')
-rw-r--r--regress/lib/libc/stdio_threading/include/local.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/regress/lib/libc/stdio_threading/include/local.h b/regress/lib/libc/stdio_threading/include/local.h
index e2ad4e31e02..b21fabd3901 100644
--- a/regress/lib/libc/stdio_threading/include/local.h
+++ b/regress/lib/libc/stdio_threading/include/local.h
@@ -36,10 +36,10 @@ thread(void *arg)
int r;
if ((r = pthread_rwlock_rdlock(&start)))
- errx(1, "could not obtain lock in thread: %s", strerror(r));
+ errc(1, r, "could not obtain lock in thread");
real_func(arg);
if ((r = pthread_rwlock_unlock(&start)))
- errx(1, "could not release lock in thread: %s", strerror(r));
+ errc(1, r, "could not release lock in thread");
return NULL;
}
@@ -52,20 +52,20 @@ run_threads(void (*func)(void *), void *arg)
self = pthread_self();
real_func = func;
if ((r = pthread_rwlock_init(&start, NULL)))
- errx(1, "could not initialize lock: %s", strerror(r));
+ errc(1, r, "could not initialize lock");
if ((r = pthread_rwlock_wrlock(&start))) /* block */
- errx(1, "could not lock lock: %s", strerror(r));
+ errc(1, r, "could not lock lock");
for (i = 0; i < THREAD_COUNT; i++)
if ((r = pthread_create(&pthread[i], NULL, thread, arg))) {
- warnx("could not create thread: %s", strerror(r));
+ warnc(r, "could not create thread");
pthread[i] = self;
}
if ((r = pthread_rwlock_unlock(&start))) /* unleash */
- errx(1, "could not release lock: %s", strerror(r));
+ errc(1, r, "could not release lock");
sleep(1);
@@ -76,6 +76,6 @@ run_threads(void (*func)(void *), void *arg)
for (i = 0; i < THREAD_COUNT; i++)
if (! pthread_equal(pthread[i], self) &&
(r = pthread_join(pthread[i], NULL)))
- warnx("could not join thread: %s", strerror(r));
+ warnc(r, "could not join thread");
}