From 5ad04d351680822078003e2b066cfc9680d6157d Mon Sep 17 00:00:00 2001 From: guenther Date: Tue, 20 May 2014 01:25:23 +0000 Subject: Use errc/warnc to simplify code. Also, in 'ftp', always put the error message last, after the hostname/ipaddr. ok jsing@ krw@ millert@ --- regress/lib/libc/stdio_threading/include/local.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'regress/lib/libc/stdio_threading/include') 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"); } -- cgit v1.2.3-59-g8ed1b