|
Message-ID: <20221113171036.GM29905@brightrain.aerifal.cx> Date: Sun, 13 Nov 2022 12:10:37 -0500 From: Rich Felker <dalias@...c.org> To: musl@...ts.openwall.com Subject: Re: [PATCH] pthread_atfork: fix return value on malloc failure On Sun, Nov 13, 2022 at 04:20:23PM +0100, Szabolcs Nagy wrote: > * Alexey Izbyshev <izbyshev@...ras.ru> [2022-11-12 16:31:01 +0300]: > > POSIX requires pthread_atfork to report errors via its return value, > > not via errno. The only specified error is ENOMEM. > > this patch looks good. Yes, looks good to me. Taking it with just one style thing changed (not spelled out anywhere): generally source files keep the header for the interface they're defining at the very top, with headers for interfaces they use below that. > > > > --- > > src/thread/pthread_atfork.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/src/thread/pthread_atfork.c b/src/thread/pthread_atfork.c > > index 76497401..2fbe23ca 100644 > > --- a/src/thread/pthread_atfork.c > > +++ b/src/thread/pthread_atfork.c > > @@ -1,3 +1,4 @@ > > +#include <errno.h> > > #include <pthread.h> > > #include "libc.h" > > #include "lock.h" > > @@ -34,7 +35,7 @@ void __fork_handler(int who) > > int pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void)) > > { > > struct atfork_funcs *new = malloc(sizeof *new); > > - if (!new) return -1; > > + if (!new) return ENOMEM; > > > > LOCK(lock); > > new->next = funcs; > > -- > > 2.37.2
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.