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.22 by root, Tue Jan 11 04:44:57 2005 UTC vs.
Revision 1.24 by root, Sat Dec 31 16:06:48 2005 UTC

74get_pty (int *fd_tty, char **ttydev) 74get_pty (int *fd_tty, char **ttydev)
75{ 75{
76 int pfd; 76 int pfd;
77 77
78#ifdef PTYS_ARE_OPENPTY 78#ifdef PTYS_ARE_OPENPTY
79 char tty_name[sizeof "/dev/pts/????\0"]; 79 char tty_name[sizeof "/dev/pts/?????\0"];
80 80
81 rxvt_privileges (RESTORE);
81 if (openpty (&pfd, fd_tty, tty_name, NULL, NULL) != -1) 82 int res = openpty (&pfd, fd_tty, tty_name, NULL, NULL);
83 rxvt_privileges (IGNORE);
84
85 if (res != -1)
82 { 86 {
83 *ttydev = strdup (tty_name); 87 *ttydev = strdup (tty_name);
84 return pfd; 88 return pfd;
85 } 89 }
86#endif 90#endif
334} ttyconf; 338} ttyconf;
335 339
336void 340void
337rxvt_ptytty::privileges (rxvt_privaction action) 341rxvt_ptytty::privileges (rxvt_privaction action)
338{ 342{
343 if (tty < 0)
344 return;
345
339 rxvt_privileges (RESTORE); 346 rxvt_privileges (RESTORE);
340 347
341 if (action == SAVE) 348 if (action == SAVE)
342 { 349 {
343 //next_tty_action = RESTORE; 350 //next_tty_action = RESTORE;
345 /* store original tty status for restoration rxvt_clean_exit () -- rgg 04/12/95 */ 352 /* store original tty status for restoration rxvt_clean_exit () -- rgg 04/12/95 */
346 if (lstat (name, &savestat) < 0) /* you lose out */ 353 if (lstat (name, &savestat) < 0) /* you lose out */
347 ;//next_tty_action = IGNORE; 354 ;//next_tty_action = IGNORE;
348 else 355 else
349# endif 356# endif
350
351 { 357 {
352 chown (name, getuid (), ttyconf.gid); /* fail silently */ 358 chown (name, getuid (), ttyconf.gid); /* fail silently */
353 chmod (name, ttyconf.mode); 359 chmod (name, ttyconf.mode);
354# ifdef HAVE_REVOKE 360# ifdef HAVE_REVOKE
355 revoke (name); 361 revoke (name);
356# endif 362# endif
357
358 } 363 }
359 } 364 }
360 else 365 else
361 { /* action == RESTORE */ 366 { /* action == RESTORE */
362 //next_tty_action = IGNORE; 367 //next_tty_action = IGNORE;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines