mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-22 01:40:17 -05:00
slave: configure pts to be the controlling terminal of the forked process
This commit is contained in:
parent
980606233b
commit
e654cf3880
2 changed files with 8 additions and 0 deletions
|
|
@ -69,6 +69,7 @@
|
|||
* `OSC 12 ?` to return the cursor color, not the cursor's text color.
|
||||
* `OSC 12;#000000` to configure the cursor to use inverted
|
||||
foreground/background colors.
|
||||
* Call `ioctl(TIOCSCTTY)` on the pts fd in the slave process.
|
||||
|
||||
|
||||
### Security
|
||||
|
|
|
|||
7
slave.c
7
slave.c
|
|
@ -10,6 +10,7 @@
|
|||
#include <signal.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#define LOG_MODULE "slave"
|
||||
|
|
@ -93,6 +94,12 @@ slave_exec(int ptmx, char *argv[], int err_fd, bool login_shell)
|
|||
goto err;
|
||||
}
|
||||
|
||||
if (ioctl(pts, TIOCSCTTY, 0) < 0) {
|
||||
LOG_ERRNO("failed to configure controlling terminal");
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
||||
if (dup2(pts, STDIN_FILENO) == -1 ||
|
||||
dup2(pts, STDOUT_FILENO) == -1 ||
|
||||
dup2(pts, STDERR_FILENO) == -1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue