- switch(pid = fork()) {
- case -1: /* error */
- break;
- case 0: /* child */
- /*
- * Restore original signal dispositions and exec the command.
- */
- (void)_sigaction(SIGINT, &intact, NULL);
- (void)_sigaction(SIGQUIT, &quitact, NULL);
- (void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
- execl(_PATH_BSHELL, "sh", "-c", command, (char *)NULL);
- _exit(127);
- default: /* parent */
+ (void)posix_spawnattr_setsigmask(&attr, &oldsigblock);
+ if (flags & POSIX_SPAWN_SETSIGDEF) {
+ (void)posix_spawnattr_setsigdefault(&attr, &defaultsig);
+ }
+ (void)posix_spawnattr_setflags(&attr, flags);
+
+ err = posix_spawn(&pid, _PATH_BSHELL, NULL, &attr, (char *const *)argv, environ);
+ (void)posix_spawnattr_destroy(&attr);
+ if (err == 0) {