mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-20 05:33:47 -04:00
slave: turn on FD_CLOEXEC after slave has been spawned
This ensures that our ptmx FD isn't carried over to other terminals spawned later.
This commit is contained in:
parent
8d9ad96b52
commit
8cf981ca12
1 changed files with 9 additions and 0 deletions
9
slave.c
9
slave.c
|
|
@ -127,6 +127,15 @@ slave_spawn(int ptmx, int argc, char *const *argv,
|
||||||
return -1;
|
return -1;
|
||||||
} else
|
} else
|
||||||
LOG_DBG("%s: successfully started", conf_shell);
|
LOG_DBG("%s: successfully started", conf_shell);
|
||||||
|
|
||||||
|
int fd_flags;
|
||||||
|
if ((fd_flags = fcntl(ptmx, F_GETFD)) < 0 ||
|
||||||
|
fcntl(ptmx, F_SETFD, fd_flags | FD_CLOEXEC) < 0)
|
||||||
|
{
|
||||||
|
LOG_ERRNO("failed to set FD_CLOEXEC on ptmx");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue