You need to sign in or sign up before continuing.
提交 8f7bc690 编写于 作者: R Rich Felker

use direct syscall rather than write function in posix_spawn child

the write function is a cancellation point and accesses thread-local
state belonging to the calling thread in the parent process. since
cancellation is blocked for the duration of posix_spawn, this is
probably safe, but it's fragile and unnecessary. making the syscall
directly is just as easy and clearly safe.
上级 1c12c243
...@@ -136,7 +136,7 @@ static int child(void *args_vp) ...@@ -136,7 +136,7 @@ static int child(void *args_vp)
fail: fail:
/* Since sizeof errno < PIPE_BUF, the write is atomic. */ /* Since sizeof errno < PIPE_BUF, the write is atomic. */
ret = -ret; ret = -ret;
if (ret) while (write(p, &ret, sizeof ret) < 0); if (ret) while (__syscall(SYS_write, p, &ret, sizeof ret) < 0);
_exit(127); _exit(127);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册