Download raw body.
rpki-client: add error checks for pthread_* calls
On Mon, Jun 23, 2025 at 10:23 PM David Gwynne <david@gwynne.id.au> wrote:
>
> On Fri, Jun 20, 2025 at 12:00:13PM +0000, Job Snijders wrote:
> > Perhaps good to add error checking to the pthread_* calls?
>
> yes...
>
> > While there, the rwlock_unlock in auth_insert() seemed somewhat
> > superfluous given that the program errors out right after.
> >
> > OK?
>
> sorry to go way back in time on this thread, but the way you're handling
> errors from the pthread api and how i understand that api don't line up.
>
> my understanding is that pthread functions return error codes
> directly, and they don't set errno. therefore, rather than handling
> errors like this:
>
> if (pthread_create(&writer, NULL, &parse_writer, &fd) != 0)
> errx(1, "pthread_create");
Well, errx() ignores errno, so on failure this will just report
rpki-client: pthread_create
which, I agree, is _not_ our greatest error message...
> you should be doing this:
>
> int error;
>
> error = pthread_create(&writer, NULL, &parse_writer, &fd);
> if (error != 0)
> errc(1, error, "pthread_create");
or
errx(1, "pthread_create: %s", strerror(error));
Philip Guenther
rpki-client: add error checks for pthread_* calls