Index | Thread | Search

From:
Theo Buehler <tb@theobuehler.org>
Subject:
Re: rpki-client: add error checks for pthread_* calls
To:
David Gwynne <david@gwynne.id.au>
Cc:
Job Snijders <job@openbsd.org>, tech@openbsd.org
Date:
Tue, 24 Jun 2025 07:25:45 +0200

Download raw body.

Thread
  • David Gwynne:

    rpki-client: add error checks for pthread_* calls

  • On Tue, Jun 24, 2025 at 03:22:21PM +1000, David Gwynne 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");
    > 
    > you should be doing this:
    > 
    > 	int error;
    > 
    > 	error = pthread_create(&writer, NULL, &parse_writer, &fd);
    > 	if (error != 0)
    > 		errc(1, error, "pthread_create");
    
    The reason for this is a cheat around a portability issue with errc(),
    which isn't provided by glibc and musl. We should fix this in portable.
    But automake is terribly annoying.
    
    
  • David Gwynne:

    rpki-client: add error checks for pthread_* calls