if (pid < 0) {
ret->error = dupprintf("fork: %s", strerror(errno));
+ sfree(cmd);
return (Socket)ret;
} else if (pid == 0) {
close(0);
dup2(from_cmd_pipe[1], 1);
close(to_cmd_pipe[0]);
close(from_cmd_pipe[1]);
- fcntl(0, F_SETFD, 0);
- fcntl(1, F_SETFD, 0);
+ noncloexec(0);
+ noncloexec(1);
execl("/bin/sh", "sh", "-c", cmd, (void *)NULL);
_exit(255);
}