]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Prevent pthread_join from hiding some other thread's error
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Mon, 30 Oct 2023 20:44:02 +0000 (14:44 -0600)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Mon, 30 Oct 2023 20:45:13 +0000 (14:45 -0600)
src/object/tal.c

index 1a8fd3123655147b2685a8394d92f2ddcd0b74cc..24a6efa8969d7e7b6a2cc2d66521f7b6ce99bf72 100644 (file)
@@ -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(&param.threads);
@@ -648,10 +648,10 @@ perform_standalone_validation(struct db_table *table)
        /* Wait for all */
        while (!SLIST_EMPTY(&param.threads)) {
                thread = SLIST_FIRST(&param.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(&param.threads, next);
                if (thread->exit_status) {
                        error = thread->exit_status;