summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLu, Han <han.lu@intel.com>2016-04-17 09:26:45 +0800
committerTakashi Iwai <tiwai@suse.de>2016-04-18 16:34:08 +0200
commit569f2c116ee30de8a16fef0822e13dd33a41f33e (patch)
treeefc3e9bb4f1b0b186246c95f264a499d98f4a511
parent85827fbb642463ab724a9471a7a88f93fa2a217d (diff)
downloadalsa-utils-569f2c116ee30de8a16fef0822e13dd33a41f33e.tar.gz
alsabat: add terminate status check for capture thread
In loopback test, alsabat use pthread_join(pthread_t thread, **retval) to wait for the capture thread to terminate. If the capture thread was canceled, PTHREAD_CANCELED is placed in *retval, and the access to the **retval will fail. Add status check to prevent illegal access to the **retval. Signed-off-by: Lu, Han <han.lu@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--bat/bat.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/bat/bat.c b/bat/bat.c
index e824065..1afdcb4 100644
--- a/bat/bat.c
+++ b/bat/bat.c
@@ -192,6 +192,12 @@ static void test_loopback(struct bat *bat)
exit(EXIT_FAILURE);
}
+ /* check if capture thread is canceled or not */
+ if (thread_result_capture == PTHREAD_CANCELED) {
+ fprintf(bat->log, _("Capture canceled.\n"));
+ return;
+ }
+
/* check capture status */
if (*thread_result_capture != 0) {
fprintf(bat->err, _("Exit capture thread fail: %d\n"),