Differences From Artifact [7068ffe502]:
- File unix/pty.c — part of check-in [7f9a81d03e] at 2002-10-16 07:17:51 on branch trunk — Fix utmp and pty handling so that GTK never complains about running set[ug]id. All privs-requiring pty operations are done at the very start of the run, then privs are dropped before initialising GTK. Utmp is handled by forking a still-privileged subprocess at this point, and later asking it (through a pipe) to stamp utmp. The subprocess cleans up utmp on exit, which has the additional advantage that if the main pterm process suffers some sort of unexpected termination (up to and including SIGKILL) the subprocess can still mop up utmp. (user: simon size: 12945)
To Artifact [1a2f5bd014]:
- File unix/pty.c — part of check-in [e44f39631e] at 2002-10-21 18:00:18 on branch trunk — Don't bother closing fds 0-2 before dup2ing over them; there's no need, and it means we always have a valid open stderr. (user: simon size: 12912)
| ︙ | ︙ | |||
428 429 430 431 432 433 434 |
slavefd = open(pty_name, O_RDWR);
if (slavefd < 0) {
perror("slave pty: open");
exit(1);
}
close(pty_master_fd);
| < < < | 428 429 430 431 432 433 434 435 436 437 438 439 440 441 |
slavefd = open(pty_name, O_RDWR);
if (slavefd < 0) {
perror("slave pty: open");
exit(1);
}
close(pty_master_fd);
fcntl(slavefd, F_SETFD, 0); /* don't close on exec */
dup2(slavefd, 0);
dup2(slavefd, 1);
dup2(slavefd, 2);
setsid();
ioctl(slavefd, TIOCSCTTY, 1);
pgrp = getpid();
|
| ︙ | ︙ |