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.23 by root, Thu Feb 17 15:07:48 2005 UTC vs.
Revision 1.26 by root, Mon Jan 2 15:10:18 2006 UTC

90 if (*ttydev != NULL) 90 if (*ttydev != NULL)
91 return pfd; 91 return pfd;
92#endif 92#endif
93 93
94#ifdef PTYS_ARE_GETPTY 94#ifdef PTYS_ARE_GETPTY
95
96 char *ptydev; 95 char *ptydev;
97 96
98 while ((ptydev = getpty ()) != NULL) 97 while ((ptydev = getpty ()) != NULL)
99 if ((pfd = open (ptydev, O_RDWR | O_NOCTTY, 0)) >= 0) 98 if ((pfd = open (ptydev, O_RDWR | O_NOCTTY, 0)) >= 0)
100 { 99 {
334} ttyconf; 333} ttyconf;
335 334
336void 335void
337rxvt_ptytty::privileges (rxvt_privaction action) 336rxvt_ptytty::privileges (rxvt_privaction action)
338{ 337{
339 if (tty < 0) 338 if (!name || !*name)
340 return; 339 return;
341 340
342 rxvt_privileges (RESTORE); 341 rxvt_privileges (RESTORE);
343 342
344 if (action == SAVE) 343 if (action == SAVE)
345 { 344 {
346 //next_tty_action = RESTORE;
347# ifndef RESET_TTY_TO_COMMON_DEFAULTS 345# ifndef RESET_TTY_TO_COMMON_DEFAULTS
348 /* store original tty status for restoration rxvt_clean_exit () -- rgg 04/12/95 */ 346 /* store original tty status for restoration rxvt_clean_exit () -- rgg 04/12/95 */
349 if (lstat (name, &savestat) < 0) /* you lose out */ 347 if (lstat (name, &savestat) < 0) /* you lose out */
350 ;//next_tty_action = IGNORE; 348 ;
351 else 349 else
352# endif 350# endif
353 { 351 {
352 saved = true;
354 chown (name, getuid (), ttyconf.gid); /* fail silently */ 353 chown (name, getuid (), ttyconf.gid); /* fail silently */
355 chmod (name, ttyconf.mode); 354 chmod (name, ttyconf.mode);
356# ifdef HAVE_REVOKE 355# ifdef HAVE_REVOKE
357 revoke (name); 356 revoke (name);
358# endif 357# endif
359 } 358 }
360 } 359 }
361 else 360 else
362 { /* action == RESTORE */ 361 { /* action == RESTORE */
363 //next_tty_action = IGNORE;
364# ifndef RESET_TTY_TO_COMMON_DEFAULTS 362# ifndef RESET_TTY_TO_COMMON_DEFAULTS
363 if (saved)
364 {
365 chmod (name, savestat.st_mode); 365 chmod (name, savestat.st_mode);
366 chown (name, savestat.st_uid, savestat.st_gid); 366 chown (name, savestat.st_uid, savestat.st_gid);
367 }
367# else 368# else
368 chmod (name, (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)); 369 chmod (name, (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH));
369 chown (name, 0, 0); 370 chown (name, 0, 0);
370# endif 371# endif
371 372
377 378
378rxvt_ptytty::rxvt_ptytty () 379rxvt_ptytty::rxvt_ptytty ()
379{ 380{
380 pty = tty = -1; 381 pty = tty = -1;
381 name = 0; 382 name = 0;
383#ifndef NO_SETOWNER_TTYDEV
384 saved = false;
385#endif
382} 386}
383 387
384rxvt_ptytty::~rxvt_ptytty () 388rxvt_ptytty::~rxvt_ptytty ()
385{ 389{
386 put (); 390 put ();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines