slave: report exec() failure back to main process

This commit is contained in:
Daniel Eklöf 2019-07-17 09:39:12 +02:00
parent 519f721577
commit aa87be43ba
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 44 additions and 15 deletions

View file

@ -92,7 +92,7 @@ err:
}
void
slave_spawn(int ptmx, char *cmd)
slave_spawn(int ptmx, char *cmd, int err_fd)
{
int pts = -1;
const char *pts_name = ptsname(ptmx);
@ -138,6 +138,7 @@ slave_spawn(int ptmx, char *cmd)
execvp(argv[0], argv);
err:
(void)!write(err_fd, &errno, sizeof(errno));
if (argv)
free(argv);
if (pts != -1)