From: Alberto Leiva Popper Date: Mon, 30 Oct 2023 20:44:02 +0000 (-0600) Subject: Prevent pthread_join from hiding some other thread's error X-Git-Tag: 1.6.0~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f5ba33597f69e4dcd64e7e055fff0ad577845e41;p=thirdparty%2FFORT-validator.git Prevent pthread_join from hiding some other thread's error --- diff --git a/src/object/tal.c b/src/object/tal.c index 1a8fd312..24a6efa8 100644 --- a/src/object/tal.c +++ b/src/object/tal.c @@ -628,7 +628,7 @@ perform_standalone_validation(struct db_table *table) { struct tal_param param; struct validation_thread *thread; - int error; + int error, tmperr; param.db = table; SLIST_INIT(¶m.threads); @@ -648,10 +648,10 @@ perform_standalone_validation(struct db_table *table) /* Wait for all */ while (!SLIST_EMPTY(¶m.threads)) { thread = SLIST_FIRST(¶m.threads); - error = pthread_join(thread->pid, NULL); - if (error) + tmperr = pthread_join(thread->pid, NULL); + if (tmperr) pr_crit("pthread_join() threw %d on the '%s' thread.", - error, thread->tal_file); + tmperr, thread->tal_file); SLIST_REMOVE_HEAD(¶m.threads, next); if (thread->exit_status) { error = thread->exit_status;