From fdb28198d310cc194c8e28a386c1862bd09d5b0e Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Sun, 8 Mar 2009 09:31:45 -0400 Subject: [PATCH] check the return of pth_mutex_acquire and pth_mutex_release in lock.h --- src/lock.h | 6 +++--- src/pwmd.c | 9 +++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/lock.h b/src/lock.h index 151a025e..3d246073 100644 --- a/src/lock.h +++ b/src/lock.h @@ -40,14 +40,14 @@ #define MUTEX_LOCK(m) \ MUTEX_LOCK_DEBUG \ if (pth_mutex_acquire(m, FALSE, NULL) == FALSE) { \ - log_write("%s(%i): %s: UNLOCK", __FILE__, __LINE__, __FUNCTION__); \ + log_write("%s(%i): %s: LOCK", __FILE__, __LINE__, strerror(errno)); \ assert(0); \ } #define MUTEX_UNLOCK(m) \ MUTEX_UNLOCK_DEBUG \ if (pth_mutex_release(m) == FALSE) { \ - log_write("%s(%i): %s: UNLOCK", __FILE__, __LINE__, __FUNCTION__); \ + log_write("%s(%i): %s: UNLOCK", __FILE__, __LINE__, strerror(errno)); \ assert(0); \ } @@ -61,7 +61,7 @@ MUTEX_LOCK(m); \ } \ else { \ - log_write("%s(%i): %s: UNLOCK", __FILE__, __LINE__, __FUNCTION__); \ + log_write("%s(%i): %s: LOCK", __FILE__, __LINE__, __FUNCTION__); \ assert(0); \ } \ } \ diff --git a/src/pwmd.c b/src/pwmd.c index 630bab94..208b4117 100644 --- a/src/pwmd.c +++ b/src/pwmd.c @@ -418,9 +418,7 @@ static void cleanup_cb(void *arg) if (cn->msg_tid) { pth_cancel(cn->msg_tid); - fprintf(stderr, "%s(%i): %s\n", __FILE__, __LINE__, __FUNCTION__); pth_join(cn->msg_tid, NULL); - fprintf(stderr, "%s(%i): %s\n", __FILE__, __LINE__, __FUNCTION__); } for (;;) { @@ -567,10 +565,9 @@ static void *client_thread(void *data) #ifdef WITH_PINENTRY pth_event_t pev = NULL; #endif - pth_event_t ev; pth_status_t st; - - ev = pth_event(PTH_EVENT_FD|PTH_UNTIL_FD_READABLE, cl->thd->fd); + pth_event_t ev = pth_event(PTH_EVENT_FD|PTH_UNTIL_FD_READABLE, + cl->thd->fd); #ifdef WITH_PINENTRY if (cl->pinentry->status == PINENTRY_RUNNING) { @@ -629,7 +626,7 @@ static void *client_thread(void *data) pth_event_free(pev, PTH_FREE_THIS); } - pinentry_iterate(cl, + rc = pinentry_iterate(cl, pev && cl->pinentry->fd != -1 && st == PTH_STATUS_OCCURRED); #endif } -- 2.11.4.GIT