X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftap%2Ftap.c;h=bf8a276c7926a3cad99618cce1eaafbaf9d61582;hp=b7a84ac9900b398a40687e4e2fedd2bef3049518;hb=926996e88c32445c874ff9c4f47f159db6b45995;hpb=b2e751d04e590c49de02ceb56a7cafe877762b0e diff --git a/ccan/tap/tap.c b/ccan/tap/tap.c index b7a84ac9..bf8a276c 100644 --- a/ccan/tap/tap.c +++ b/ccan/tap/tap.c @@ -45,8 +45,13 @@ static int test_died = 0; static int test_pid; /* Encapsulate the pthread code in a conditional. In the absence of - libpthread the code does nothing */ -#if HAVE_LIBPTHREAD + libpthread the code does nothing. + + If you have multiple threads calling ok() etc. at the same time you would + need this, but in that case your test numbers will be random and I'm not + sure it makes sense. --RR +*/ +#ifdef WANT_PTHREAD #include static pthread_mutex_t M = PTHREAD_MUTEX_INITIALIZER; # define LOCK pthread_mutex_lock(&M) @@ -413,8 +418,8 @@ todo_end(void) UNLOCK; } -int -exit_status(void) +static int +exit_status_(void) { int r; @@ -441,3 +446,12 @@ exit_status(void) return r; } + +int +exit_status(void) +{ + int r = exit_status_(); + if (r > 255) + r = 255; + return r; +}