… | |
… | |
221 | * Make our tty a controlling tty so that /dev/tty points to us |
221 | * Make our tty a controlling tty so that /dev/tty points to us |
222 | */ |
222 | */ |
223 | static int |
223 | static int |
224 | control_tty (int fd_tty) |
224 | control_tty (int fd_tty) |
225 | { |
225 | { |
|
|
226 | int fd; |
|
|
227 | |
226 | setsid (); |
228 | setsid (); |
227 | |
229 | |
228 | #if defined(HAVE_DEV_PTMX) && defined(I_PUSH) |
230 | #if defined(HAVE_DEV_PTMX) && defined(I_PUSH) |
229 | /* |
231 | /* |
230 | * Push STREAMS modules: |
232 | * Push STREAMS modules: |
… | |
… | |
254 | #endif |
256 | #endif |
255 | |
257 | |
256 | #ifdef TIOCSCTTY |
258 | #ifdef TIOCSCTTY |
257 | ioctl (fd_tty, TIOCSCTTY, NULL); |
259 | ioctl (fd_tty, TIOCSCTTY, NULL); |
258 | #else |
260 | #else |
259 | fd = open (name, O_RDWR); |
261 | fd = open (ttyname (fd_tty), O_RDWR); |
260 | if (fd >= 0) |
262 | if (fd >= 0) |
261 | close (fd); |
263 | close (fd); |
262 | #endif |
264 | #endif |
263 | |
265 | |
264 | int fd = open ("/dev/tty", O_WRONLY); |
266 | fd = open ("/dev/tty", O_WRONLY); |
265 | if (fd < 0) |
267 | if (fd < 0) |
266 | return -1; /* fatal */ |
268 | return -1; /* fatal */ |
267 | |
269 | |
268 | close (fd); |
270 | close (fd); |
269 | |
271 | |