From 1febdf9a370502581a834dd48e683228375ba69b Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Wed, 22 Dec 2010 12:10:56 +0000 Subject: [PATCH] Log error state from pthread_join operation Value jstat is unused - so replace it with logging via log_sys_error(). --- WHATS_NEW | 1 + daemons/clvmd/clvmd.c | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index f370948fc..51e2eab81 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.80 - ==================================== + Log error message for pthread_join() failure in clvmd. Version 2.02.79 - 20th December 2010 ==================================== diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c index 1a35c495b..ae4da65c3 100644 --- a/daemons/clvmd/clvmd.c +++ b/daemons/clvmd/clvmd.c @@ -666,7 +666,6 @@ static int local_pipe_callback(struct local_client *thisfd, char *buf, /* EOF on pipe or an error, close it */ if (len <= 0) { - int jstat; void *ret = &status; close(thisfd->fd); @@ -677,7 +676,9 @@ static int local_pipe_callback(struct local_client *thisfd, char *buf, /* Reap child thread */ if (thisfd->bits.pipe.threadid) { - jstat = pthread_join(thisfd->bits.pipe.threadid, &ret); + if (pthread_join(thisfd->bits.pipe.threadid, &ret)) + log_sys_error("pthread_join", ""); + thisfd->bits.pipe.threadid = 0; if (thisfd->bits.pipe.client != NULL) thisfd->bits.pipe.client->bits.localsock. @@ -1041,7 +1042,6 @@ static int read_from_local_sock(struct local_client *thisfd) /* EOF or error on socket */ if (len <= 0) { int *status; - int jstat; DEBUGLOG("EOF on local socket: inprogress=%d\n", thisfd->bits.localsock.in_progress); @@ -1068,9 +1068,10 @@ static int read_from_local_sock(struct local_client *thisfd) pthread_cond_signal(&thisfd->bits.localsock.cond); pthread_mutex_unlock(&thisfd->bits.localsock.mutex); - jstat = - pthread_join(thisfd->bits.localsock.threadid, - (void **) &status); + if (pthread_join(thisfd->bits.localsock.threadid, + (void **) &status)) + log_sys_error("pthread_join", ""); + DEBUGLOG("Joined child thread\n"); thisfd->bits.localsock.threadid = 0;