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

Comparing rxvt-unicode/src/main.C (file contents):
Revision 1.172 by root, Wed Jan 11 05:14:26 2006 UTC vs.
Revision 1.176 by root, Thu Jan 12 01:30:53 2006 UTC

478/*----------------------------------------------------------------------*/ 478/*----------------------------------------------------------------------*/
479bool 479bool
480rxvt_term::init (int argc, const char *const *argv) 480rxvt_term::init (int argc, const char *const *argv)
481{ 481{
482 SET_R (this); 482 SET_R (this);
483 TEMP_ENV; // few things in X do not call setlocale :( 483 set_environ (envv); // few things in X do not call setlocale :(
484 484
485 set_locale (""); 485 set_locale ("");
486 486
487 if (!init_vars ()) 487 if (!init_vars ())
488 return false; 488 return false;
523 rs[Rs_perl_eval] = 0; 523 rs[Rs_perl_eval] = 0;
524 } 524 }
525 } 525 }
526#endif 526#endif
527 rxvt_perl.init (); 527 rxvt_perl.init ();
528 setlocale (LC_CTYPE, curlocale); // perl init destroys current locale
528 HOOK_INVOKE ((this, HOOK_INIT, DT_END)); 529 HOOK_INVOKE ((this, HOOK_INIT, DT_END));
529 } 530 }
530#endif 531#endif
531 532
532 create_windows (argc, argv); 533 create_windows (argc, argv);
615 sw_int (this, &sig_handlers::sig_term) 616 sw_int (this, &sig_handlers::sig_term)
616 { 617 {
617 } 618 }
618} sig_handlers; 619} sig_handlers;
619 620
621char **rxvt_environ; // startup environment
622
620void 623void
621rxvt_init () 624rxvt_init ()
622{ 625{
626 rxvt_environ = environ;
627
623 /* 628 /*
624 * Save and then give up any super-user privileges 629 * Save and then give up any super-user privileges
625 * If we need privileges in any area then we must specifically request it. 630 * If we need privileges in any area then we must specifically request it.
626 * We should only need to be root in these cases: 631 * We should only need to be root in these cases:
627 * 1. write utmp entries on some systems 632 * 1. write utmp entries on some systems
703 case IGNORE: 708 case IGNORE:
704 /* 709 /*
705 * change effective uid/gid - not real uid/gid - so we can switch 710 * change effective uid/gid - not real uid/gid - so we can switch
706 * back to root later, as required 711 * back to root later, as required
707 */ 712 */
713 setegid (getgid ());
708 seteuid (getuid ()); 714 seteuid (getuid ());
709 setegid (getgid ());
710 break; 715 break;
711 case SAVE: 716 case SAVE:
717 saved_egid = getegid ();
712 saved_euid = geteuid (); 718 saved_euid = geteuid ();
713 saved_egid = getegid ();
714 break; 719 break;
715 case RESTORE: 720 case RESTORE:
721 setegid (saved_egid);
716 seteuid (saved_euid); 722 seteuid (saved_euid);
717 setegid (saved_egid);
718 break; 723 break;
719 } 724 }
720# else 725# else
721 switch (action) 726 switch (action)
722 { 727 {
723 case IGNORE: 728 case IGNORE:
729 setgid (getgid ());
724 setuid (getuid ()); 730 setuid (getuid ());
725 setgid (getgid ());
726 /* FALLTHROUGH */ 731 /* FALLTHROUGH */
727 case SAVE: 732 case SAVE:
728 /* FALLTHROUGH */ 733 /* FALLTHROUGH */
729 case RESTORE: 734 case RESTORE:
730 break; 735 break;
1446 unsigned long fg, bg; 1451 unsigned long fg, bg;
1447 const char *p; 1452 const char *p;
1448 char **s; 1453 char **s;
1449 XIMStyles *xim_styles; 1454 XIMStyles *xim_styles;
1450 1455
1451 TEMP_ENV; 1456 set_environ (envv);
1452 1457
1453 if (! ((p = XSetLocaleModifiers (modifiers)) && *p)) 1458 if (! ((p = XSetLocaleModifiers (modifiers)) && *p))
1454 return false; 1459 return false;
1455 1460
1456 D_MAIN ((stderr, "rxvt_IM_get_IC ()")); 1461 D_MAIN ((stderr, "rxvt_IM_get_IC ()"));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines