diff options
-rw-r--r-- | src/process/fork.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/process/fork.c b/src/process/fork.c index a12da01a..8d34a9c4 100644 --- a/src/process/fork.c +++ b/src/process/fork.c @@ -1,4 +1,5 @@ #include <unistd.h> +#include <errno.h> #include "libc.h" static void dummy(int x) { } @@ -8,6 +9,8 @@ pid_t fork(void) { __fork_handler(-1); pid_t ret = _Fork(); + int errno_save = errno; __fork_handler(!ret); + if (ret<0) errno = errno_save; return ret; } |