version 1.21, 2001/02/04 15:32:24 |
version 1.22, 2001/02/08 19:30:52 |
|
|
|
|
/* First disconnect from the old controlling tty. */ |
/* First disconnect from the old controlling tty. */ |
#ifdef TIOCNOTTY |
#ifdef TIOCNOTTY |
fd = open("/dev/tty", O_RDWR | O_NOCTTY); |
fd = open(_PATH_TTY, O_RDWR | O_NOCTTY); |
if (fd >= 0) { |
if (fd >= 0) { |
(void) ioctl(fd, TIOCNOTTY, NULL); |
(void) ioctl(fd, TIOCNOTTY, NULL); |
close(fd); |
close(fd); |
|
|
* Verify that we are successfully disconnected from the controlling |
* Verify that we are successfully disconnected from the controlling |
* tty. |
* tty. |
*/ |
*/ |
fd = open("/dev/tty", O_RDWR | O_NOCTTY); |
fd = open(_PATH_TTY, O_RDWR | O_NOCTTY); |
if (fd >= 0) { |
if (fd >= 0) { |
error("Failed to disconnect from controlling tty."); |
error("Failed to disconnect from controlling tty."); |
close(fd); |
close(fd); |
|
|
close(fd); |
close(fd); |
|
|
/* Verify that we now have a controlling tty. */ |
/* Verify that we now have a controlling tty. */ |
fd = open("/dev/tty", O_WRONLY); |
fd = open(_PATH_TTY, O_WRONLY); |
if (fd < 0) |
if (fd < 0) |
error("open /dev/tty failed - could not set controlling tty: %.100s", |
error("open /dev/tty failed - could not set controlling tty: %.100s", |
strerror(errno)); |
strerror(errno)); |