pid_t __vfork(void);
int __posix_spawnx(pid_t *restrict res, const char *restrict path,
- int (*exec)(const char *, char *const *),
+ int (*exec)(const char *, char *const *, char *const *),
const posix_spawn_file_actions_t *fa,
const posix_spawnattr_t *restrict attr,
char *const argv[restrict], char *const envp[restrict])
__acquire_ptc();
pid = __vfork();
- __release_ptc();
if (pid) {
+ __release_ptc();
sigprocmask(SIG_SETMASK, &oldmask, 0);
if (pid < 0) return -pid;
*res = pid;
sigprocmask(SIG_SETMASK, (attr->__flags & POSIX_SPAWN_SETSIGMASK)
? &attr->__mask : &oldmask, 0);
- if (envp) environ = (char **)envp;
- exec(path, argv);
+ exec(path, argv, envp ? envp : environ);
_exit(127);
return 0;
const posix_spawnattr_t *restrict attr,
char *const argv[restrict], char *const envp[restrict])
{
- return __posix_spawnx(res, path, execv, fa, attr, argv, envp);
+ return __posix_spawnx(res, path, execve, fa, attr, argv, envp);
}