From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 26965 invoked from network); 13 Nov 2022 15:20:41 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 13 Nov 2022 15:20:41 -0000 Received: (qmail 15795 invoked by uid 550); 13 Nov 2022 15:20:37 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 15748 invoked from network); 13 Nov 2022 15:20:36 -0000 Date: Sun, 13 Nov 2022 16:20:23 +0100 From: Szabolcs Nagy To: musl@lists.openwall.com Message-ID: <20221113152023.GE98588@port70.net> Mail-Followup-To: musl@lists.openwall.com References: <20221112133101.253026-1-izbyshev@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221112133101.253026-1-izbyshev@ispras.ru> Subject: Re: [musl] [PATCH] pthread_atfork: fix return value on malloc failure * Alexey Izbyshev [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. > --- > 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 > #include > #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