ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/ptytty.C
(Generate patch)

Comparing rxvt-unicode/src/ptytty.C (file contents):
Revision 1.45 by root, Tue Jan 17 18:06:14 2006 UTC vs.
Revision 1.47 by root, Thu Jan 19 10:27:27 2006 UTC

276static int 276static int
277control_tty (int fd_tty) 277control_tty (int fd_tty)
278{ 278{
279 setsid (); 279 setsid ();
280 280
281# if defined(PTYS_ARE_PTMX) && defined(I_PUSH) 281#if defined(PTYS_ARE_PTMX) && defined(I_PUSH)
282 /* 282 /*
283 * Push STREAMS modules: 283 * Push STREAMS modules:
284 * ptem: pseudo-terminal hardware emulation module. 284 * ptem: pseudo-terminal hardware emulation module.
285 * ldterm: standard terminal line discipline. 285 * ldterm: standard terminal line discipline.
286 * ttcompat: V7, 4BSD and XENIX STREAMS compatibility module. 286 * ttcompat: V7, 4BSD and XENIX STREAMS compatibility module.
294 * documentation is really unclear about whether it is any close () on 294 * documentation is really unclear about whether it is any close () on
295 * the master side or the last close () - i.e. a proper STREAMS dismantling 295 * the master side or the last close () - i.e. a proper STREAMS dismantling
296 * close () - on the master side which causes a hang up to be sent 296 * close () - on the master side which causes a hang up to be sent
297 * through - Geoff Wing 297 * through - Geoff Wing
298 */ 298 */
299# ifdef HAVE_ISASTREAM 299# ifdef HAVE_ISASTREAM
300 if (isastream (fd_tty) == 1) 300 if (isastream (fd_tty) == 1)
301# endif 301# endif
302 { 302 {
303 ioctl (fd_tty, I_PUSH, "ptem"); 303 ioctl (fd_tty, I_PUSH, "ptem");
304 ioctl (fd_tty, I_PUSH, "ldterm"); 304 ioctl (fd_tty, I_PUSH, "ldterm");
305 ioctl (fd_tty, I_PUSH, "ttcompat"); 305 ioctl (fd_tty, I_PUSH, "ttcompat");
306 } 306 }
307# endif 307#endif
308 308
309 ioctl (fd_tty, TIOCSCTTY, NULL); 309 ioctl (fd_tty, TIOCSCTTY, NULL);
310 310
311 int fd = open ("/dev/tty", O_WRONLY); 311 int fd = open ("/dev/tty", O_WRONLY);
312 if (fd < 0) 312 if (fd < 0)
636 close (sv[1]); 636 close (sv[1]);
637 fcntl (sock_fd, F_SETFD, FD_CLOEXEC); 637 fcntl (sock_fd, F_SETFD, FD_CLOEXEC);
638 } 638 }
639 else 639 else
640 { 640 {
641 setgid (getegid ());
642 setuid (geteuid ());
643
644 // server, pty-helper 641 // server, pty-helper
645 sock_fd = sv[1]; 642 sock_fd = sv[1];
646 643
647 for (int fd = 0; fd < 1023; fd++) 644 for (int fd = 0; fd < 1023; fd++)
648 if (fd != sock_fd && fd != 1) 645 if (fd != sock_fd)
649 close (fd); 646 close (fd);
650 647
651 serve (); 648 serve ();
652 _exit (EXIT_SUCCESS); 649 _exit (EXIT_SUCCESS);
653 } 650 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines