… | |
… | |
89 | rxvt_pop_locale () |
89 | rxvt_pop_locale () |
90 | { |
90 | { |
91 | rxvt_set_locale (savelocale); |
91 | rxvt_set_locale (savelocale); |
92 | } |
92 | } |
93 | |
93 | |
|
|
94 | void |
|
|
95 | rxvt_term::make_current () const |
|
|
96 | { |
|
|
97 | SET_R (this); |
|
|
98 | rxvt_set_locale (locale); |
|
|
99 | set_environ (envv); |
|
|
100 | } |
|
|
101 | |
94 | #if ENABLE_COMBINING |
102 | #if ENABLE_COMBINING |
95 | class rxvt_composite_vec rxvt_composite; |
103 | class rxvt_composite_vec rxvt_composite; |
96 | |
104 | |
97 | text_t rxvt_composite_vec::compose (unicode_t c1, unicode_t c2) |
105 | text_t rxvt_composite_vec::compose (unicode_t c1, unicode_t c2) |
98 | { |
106 | { |
… | |
… | |
377 | } |
385 | } |
378 | |
386 | |
379 | void |
387 | void |
380 | rxvt_term::destroy_cb (time_watcher &w) |
388 | rxvt_term::destroy_cb (time_watcher &w) |
381 | { |
389 | { |
382 | SET_R (this); |
390 | make_current (); |
383 | |
391 | |
384 | delete this; |
392 | delete this; |
385 | } |
393 | } |
386 | |
394 | |
387 | /*----------------------------------------------------------------------*/ |
395 | /*----------------------------------------------------------------------*/ |
… | |
… | |
478 | /*----------------------------------------------------------------------*/ |
486 | /*----------------------------------------------------------------------*/ |
479 | bool |
487 | bool |
480 | rxvt_term::init (int argc, const char *const *argv) |
488 | rxvt_term::init (int argc, const char *const *argv) |
481 | { |
489 | { |
482 | SET_R (this); |
490 | SET_R (this); |
483 | TEMP_ENV; // few things in X do not call setlocale :( |
|
|
484 | |
|
|
485 | set_locale (""); |
491 | set_locale (""); |
|
|
492 | set_environ (envv); // few things in X do not call setlocale :( |
486 | |
493 | |
487 | if (!init_vars ()) |
494 | if (!init_vars ()) |
488 | return false; |
495 | return false; |
489 | |
496 | |
490 | init_secondary (); |
497 | init_secondary (); |
… | |
… | |
523 | rs[Rs_perl_eval] = 0; |
530 | rs[Rs_perl_eval] = 0; |
524 | } |
531 | } |
525 | } |
532 | } |
526 | #endif |
533 | #endif |
527 | rxvt_perl.init (); |
534 | rxvt_perl.init (); |
|
|
535 | setlocale (LC_CTYPE, curlocale); // perl init destroys current locale |
528 | HOOK_INVOKE ((this, HOOK_INIT, DT_END)); |
536 | HOOK_INVOKE ((this, HOOK_INIT, DT_END)); |
529 | } |
537 | } |
530 | #endif |
538 | #endif |
531 | |
539 | |
532 | create_windows (argc, argv); |
540 | create_windows (argc, argv); |
… | |
… | |
615 | sw_int (this, &sig_handlers::sig_term) |
623 | sw_int (this, &sig_handlers::sig_term) |
616 | { |
624 | { |
617 | } |
625 | } |
618 | } sig_handlers; |
626 | } sig_handlers; |
619 | |
627 | |
|
|
628 | char **rxvt_environ; // startup environment |
|
|
629 | |
620 | void |
630 | void |
621 | rxvt_init () |
631 | rxvt_init () |
622 | { |
632 | { |
|
|
633 | rxvt_environ = environ; |
|
|
634 | |
623 | /* |
635 | /* |
624 | * Save and then give up any super-user privileges |
636 | * Save and then give up any super-user privileges |
625 | * If we need privileges in any area then we must specifically request it. |
637 | * If we need privileges in any area then we must specifically request it. |
626 | * We should only need to be root in these cases: |
638 | * We should only need to be root in these cases: |
627 | * 1. write utmp entries on some systems |
639 | * 1. write utmp entries on some systems |
… | |
… | |
703 | case IGNORE: |
715 | case IGNORE: |
704 | /* |
716 | /* |
705 | * change effective uid/gid - not real uid/gid - so we can switch |
717 | * change effective uid/gid - not real uid/gid - so we can switch |
706 | * back to root later, as required |
718 | * back to root later, as required |
707 | */ |
719 | */ |
|
|
720 | setegid (getgid ()); |
708 | seteuid (getuid ()); |
721 | seteuid (getuid ()); |
709 | setegid (getgid ()); |
|
|
710 | break; |
722 | break; |
711 | case SAVE: |
723 | case SAVE: |
|
|
724 | saved_egid = getegid (); |
712 | saved_euid = geteuid (); |
725 | saved_euid = geteuid (); |
713 | saved_egid = getegid (); |
|
|
714 | break; |
726 | break; |
715 | case RESTORE: |
727 | case RESTORE: |
|
|
728 | setegid (saved_egid); |
716 | seteuid (saved_euid); |
729 | seteuid (saved_euid); |
717 | setegid (saved_egid); |
|
|
718 | break; |
730 | break; |
719 | } |
731 | } |
720 | # else |
732 | # else |
721 | switch (action) |
733 | switch (action) |
722 | { |
734 | { |
723 | case IGNORE: |
735 | case IGNORE: |
|
|
736 | setgid (getgid ()); |
724 | setuid (getuid ()); |
737 | setuid (getuid ()); |
725 | setgid (getgid ()); |
|
|
726 | /* FALLTHROUGH */ |
738 | /* FALLTHROUGH */ |
727 | case SAVE: |
739 | case SAVE: |
728 | /* FALLTHROUGH */ |
740 | /* FALLTHROUGH */ |
729 | case RESTORE: |
741 | case RESTORE: |
730 | break; |
742 | break; |
… | |
… | |
1446 | unsigned long fg, bg; |
1458 | unsigned long fg, bg; |
1447 | const char *p; |
1459 | const char *p; |
1448 | char **s; |
1460 | char **s; |
1449 | XIMStyles *xim_styles; |
1461 | XIMStyles *xim_styles; |
1450 | |
1462 | |
1451 | TEMP_ENV; |
1463 | set_environ (envv); |
1452 | |
1464 | |
1453 | if (! ((p = XSetLocaleModifiers (modifiers)) && *p)) |
1465 | if (! ((p = XSetLocaleModifiers (modifiers)) && *p)) |
1454 | return false; |
1466 | return false; |
1455 | |
1467 | |
1456 | D_MAIN ((stderr, "rxvt_IM_get_IC ()")); |
1468 | D_MAIN ((stderr, "rxvt_IM_get_IC ()")); |
… | |
… | |
1622 | int i; |
1634 | int i; |
1623 | const char *p; |
1635 | const char *p; |
1624 | char **s; |
1636 | char **s; |
1625 | char buf[IMBUFSIZ]; |
1637 | char buf[IMBUFSIZ]; |
1626 | |
1638 | |
1627 | SET_R (this); |
1639 | make_current (); |
1628 | |
1640 | |
1629 | im_destroy (); |
1641 | im_destroy (); |
1630 | |
1642 | |
1631 | D_MAIN ((stderr, "rxvt_IMInstantiateCallback ()")); |
1643 | D_MAIN ((stderr, "rxvt_IMInstantiateCallback ()")); |
1632 | if (Input_Context) |
1644 | if (Input_Context) |