]>
git.proxmox.com Git - wasi-libc.git/blob - libc-top-half/musl/src/unistd/setxid.c
11 static void do_setxid(void *p
)
15 int ret
= __syscall(c
->nr
, c
->id
, c
->eid
, c
->sid
);
17 /* If one thread fails to set ids after another has already
18 * succeeded, forcibly killing the process is the only safe
19 * thing to do. State is inconsistent and dangerous. Use
20 * SIGKILL because it is uncatchable. */
22 __syscall(SYS_kill
, __syscall(SYS_getpid
), SIGKILL
);
27 int __setxid(int nr
, int id
, int eid
, int sid
)
29 /* ret is initially nonzero so that failure of the first thread does not
30 * trigger the safety kill above. */
31 struct ctx c
= { .nr
= nr
, .id
= id
, .eid
= eid
, .sid
= sid
, .ret
= 1 };
32 __synccall(do_setxid
, &c
);
33 return __syscall_ret(c
.ret
);