Skip to contentSkip to conversation

master - dmeventd: add check for result code

PATCH Zdenek Kabelac 1 participant 1 message Jan 17, 2018

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f41935909fec9eb8d64bc04530be2f38866f0b8e
Commit:        f41935909fec9eb8d64bc04530be2f38866f0b8e
Parent:        02621cffb0d5ff72adb8770e26c1b4adb95bd0d9
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Fri Jan 5 21:08:24 2018 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Wed Jan 17 14:44:33 2018 +0100

dmeventd: add check for result code

Check result from pthread_kill.

---
 daemons/dmeventd/dmeventd.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
daemons/dmeventd/dmeventd.c +5 -1
index 7ad7f81..8917422 100644
@@ -754,6 +754,7 @@ static void *_timeout_thread(void *unused __attribute__((unused)))
 	struct thread_status *thread;
 	struct timespec timeout;
 	time_t curr_time;
+	int ret;
 
 	DEBUGLOG("Timeout thread starting.");
 	pthread_cleanup_push(_exit_timeout, NULL);
@@ -775,7 +776,10 @@ static void *_timeout_thread(void *unused __attribute__((unused)))
 				} else {
 					DEBUGLOG("Sending SIGALRM to Thr %x for timeout.",
 						 (int) thread->thread);
-					pthread_kill(thread->thread, SIGALRM);
+					ret = pthread_kill(thread->thread, SIGALRM);
+					if (ret && (ret != ESRCH))
+						log_error("Unable to wakeup Thr %x for timeout: %s.",
+							  (int) thread->thread, strerror(ret));
 				}
 				_unlock_mutex();
 			}