projects
/
musl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
29e4319
)
pthread_atfork: fix return value on malloc failure
author
Alexey Izbyshev
<izbyshev@ispras.ru>
Sat, 12 Nov 2022 13:31:01 +0000
(16:31 +0300)
committer
Rich Felker
<dalias@aerifal.cx>
Sat, 12 Nov 2022 17:22:38 +0000
(12:22 -0500)
POSIX requires pthread_atfork to report errors via its return value,
not via errno. The only specified error is ENOMEM.
src/thread/pthread_atfork.c
patch
|
blob
|
history
diff --git
a/src/thread/pthread_atfork.c
b/src/thread/pthread_atfork.c
index
7649740
..
6d348ac
100644
(file)
--- a/
src/thread/pthread_atfork.c
+++ b/
src/thread/pthread_atfork.c
@@
-1,4
+1,5
@@
#include <pthread.h>
+#include <errno.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;