~ubuntu-branches/ubuntu/hardy/gdm/hardy-updates

« back to all changes in this revision

Viewing changes to daemon/gdm.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2008-05-13 10:44:34 UTC
  • mfrom: (1.4.26 upstream)
  • Revision ID: james.westby@ubuntu.com-20080513104434-xg3oi65kaoz1ux8j
Tags: 2.20.6-0ubuntu1
* New upstream version (lp: #229866):
  - Fix two related bugs that were causing GDM to crash regularly on exit.
    Refer to bug #517526.  
  - Fix a third bug that was causing the GDM daemon to crash occasionally when
    using gdmsetup.  This fix changes GDM so that when it receives an
    UPDATE_CONFIG command, it only updates the key specified rather than
    re-reading the entire configuration file.  Fixes bug #517526.
  - Sync to avoid any XIO errors after session exits.  
  - Fix so that the XDMCP configuration values are read from the configuration
    file when the XDMCP manager is started rather than initialized.  It seems
    the related fixes implemented in 2.20.2 did not fully resolve this issue.
  - Fix bug that was causing GDM session desktop file marked as "Hidden=true"
    to show up in the Session dialog.  
  - Fix gdmsetup bug that caused users to need to restart GDM in order for
    it to notice changes made in the "Server settings" dialog.
  - Fix gdmsetup so it does not save 24HourClock setting as a translated 
    string, which was causing the configuration to get confused.
  - If the user's $HOME/.dmrc file does not exist, avoid calling gkeyfile 
    functions.  This avoids useless gkeyfile warning messages about the file
    being NULL.  A previous fix in 2.20.1 minimized this problem by creating
    the file if it did not exist.  However, that does not always work if the
    user's $HOME directory is not writable (e.g. LiveCD).  So this fix avoids
    the warnings.  
  - Add default OpenBSD Halt, Reboot and Suspend commands to the configure
    script.  
  - Remove broken logic in the configure script that was trying to append
    ${prefix}/bin to the DefaultPath and RootPath.  Please use the 
    --with-post-path configure option if you want to add custom directories
    to the end of DefaultPath and RootPath.  
  - Fix the way the Xsession script is built so that distros can more easily
    add their own custom logic to the Xsession script.  Some Solaris specific
    code was moved to the Xsession.solaris file so that other distros do not
    get affected by this code.  Remove logic to normalize LC_ variables since
    this was causing problems for some users.  Refer to bug #509141
* debian/patches/11_powermanagement.patch,
  debian/patches/56_xnest-wrapper.patch,
  debian/patches/70_mandatory-relibtoolize.patch:
  - updated for the new version
* debian/Xsession:
  - set the USERXSESSIONRC environment variable (lp: #229199)

Show diffs side-by-side

added added

removed removed

Lines of Context:
841
841
static gboolean
842
842
gdm_cleanup_children (void)
843
843
{
844
 
        pid_t pid;
845
844
        gint exitstatus = 0, status;
846
845
        GdmDisplay *d = NULL;
847
846
        gboolean crashed;
848
847
        gboolean sysmenu;
 
848
        pid_t pid;
849
849
 
850
850
        /* Pid and exit status of slave that died */
851
851
        pid = waitpid (-1, &exitstatus, WNOHANG);
863
863
                if (WIFSIGNALED (exitstatus)) {
864
864
                        if (WTERMSIG (exitstatus) == SIGTERM ||
865
865
                            WTERMSIG (exitstatus) == SIGINT) {
866
 
                                /* we send these signals, sometimes children don't handle them */
 
866
                                /*
 
867
                                 * We send these signals, sometimes children
 
868
                                 * do not handle them
 
869
                                 */
867
870
                                gdm_debug ("gdm_cleanup_children: child %d died of signal %d (TERM/INT)", pid,
868
871
                                           (int)WTERMSIG (exitstatus));
869
872
                        } else {
876
879
        }
877
880
 
878
881
        if (pid == extra_process) {
879
 
                /* an extra process died, yay! */
 
882
                /* An extra process died, yay! */
880
883
                extra_process = 0;
881
 
                extra_status = exitstatus;
 
884
                extra_status  = exitstatus;
882
885
                return TRUE;
883
886
        }
884
887
 
888
891
        if (d == NULL)
889
892
                return TRUE;
890
893
 
891
 
        /* whack connections about this display */
 
894
        /* Whack connections about this display */
892
895
        if (unixconn != NULL)
893
896
                gdm_kill_subconnections_with_display (unixconn, d);
894
897
 
914
917
                        gdm_server_whack_lockfile (d);
915
918
                }
916
919
 
917
 
                /* race avoider */
 
920
                /* Race avoider */
918
921
                gdm_sleep_no_signal (1);
919
922
        }
920
923
 
921
924
        /* null all these, they are not valid most definately */
922
 
        d->servpid = 0;
923
 
        d->sesspid = 0;
924
 
        d->greetpid = 0;
 
925
        d->servpid    = 0;
 
926
        d->sesspid    = 0;
 
927
        d->greetpid   = 0;
925
928
        d->chooserpid = 0;
926
929
 
927
930
        /* definately not logged in now */
933
936
        d->slavepid = 0;
934
937
        d->dispstat = DISPLAY_DEAD;
935
938
 
936
 
        sysmenu = gdm_daemon_config_get_value_bool_per_display (GDM_KEY_SYSTEM_MENU, d->name);
937
 
 
938
 
        if ( ! sysmenu &&
939
 
             (status == DISPLAY_RESTARTGDM ||
940
 
              status == DISPLAY_REBOOT ||
941
 
              status == DISPLAY_SUSPEND ||
942
 
              status == DISPLAY_HALT)) {
943
 
                gdm_info (_("Restart GDM, Restart machine, Suspend, or Halt request when there is no system menu from display %s"), d->name);
944
 
                status = DISPLAY_REMANAGE;
945
 
        }
946
 
 
947
 
        if ( ! d->attached &&
948
 
             (status == DISPLAY_RESTARTGDM ||
949
 
              status == DISPLAY_REBOOT ||
950
 
              status == DISPLAY_SUSPEND ||
951
 
              status == DISPLAY_HALT)) {
952
 
                gdm_info (_("Restart GDM, Restart machine, Suspend or Halt request from a non-static display %s"), d->name);
953
 
                status = DISPLAY_REMANAGE;
 
939
        if (status == DISPLAY_RESTARTGDM ||
 
940
            status == DISPLAY_REBOOT     ||
 
941
            status == DISPLAY_SUSPEND    ||
 
942
            status == DISPLAY_HALT) {
 
943
                /*
 
944
                 * Reset status to DISPLAY_REMANAGE if it is not valid to
 
945
                 * perform the operation
 
946
                 */
 
947
                sysmenu = gdm_daemon_config_get_value_bool_per_display (
 
948
                        GDM_KEY_SYSTEM_MENU, d->name);
 
949
 
 
950
                if (!sysmenu) {
 
951
                        gdm_info (_("Restart GDM, Restart machine, Suspend, or Halt request when there is no system menu from display %s"), d->name);
 
952
                        status = DISPLAY_REMANAGE;
 
953
                }
 
954
 
 
955
 
 
956
                if ( ! d->attached) {
 
957
                        gdm_info (_("Restart GDM, Restart machine, Suspend or Halt request from a non-static display %s"), d->name);
 
958
                        status = DISPLAY_REMANAGE;
 
959
                }
 
960
 
 
961
                /* checkout if we can actually do stuff */
 
962
                switch (status) {
 
963
                case DISPLAY_REBOOT:
 
964
                        if (gdm_daemon_config_get_value_string_array (GDM_KEY_REBOOT) == NULL)
 
965
                                status = DISPLAY_REMANAGE;
 
966
                        break;
 
967
                case DISPLAY_HALT:
 
968
                        if (gdm_daemon_config_get_value_string_array (GDM_KEY_HALT) == NULL)
 
969
                                status = DISPLAY_REMANAGE;
 
970
                        break;
 
971
                case DISPLAY_SUSPEND:
 
972
                        if (gdm_daemon_config_get_value_string_array (GDM_KEY_SUSPEND) == NULL)
 
973
                                status = DISPLAY_REMANAGE;
 
974
                        break;
 
975
                default:
 
976
                        break;
 
977
                }
954
978
        }
955
979
 
956
980
        if (status == DISPLAY_RUN_CHOOSER) {
957
 
                /* use the chooser on the next run (but only if allowed) */
 
981
                sysmenu = gdm_daemon_config_get_value_bool_per_display (
 
982
                        GDM_KEY_SYSTEM_MENU, d->name);
 
983
 
 
984
                /* Use the chooser on the next run (but only if allowed) */
958
985
                if (sysmenu &&
959
 
                    gdm_daemon_config_get_value_bool_per_display (GDM_KEY_CHOOSER_BUTTON, d->name))
 
986
                    gdm_daemon_config_get_value_bool_per_display (
 
987
                        GDM_KEY_CHOOSER_BUTTON, d->name)) {
960
988
                        d->use_chooser = TRUE;
 
989
                }
 
990
 
961
991
                status = DISPLAY_REMANAGE;
962
 
                /* go around the display loop detection, these are short
 
992
                /*
 
993
                 * Go around the display loop detection, these are short
963
994
                 * sessions, so this decreases the chances of the loop
964
 
                 * detection being hit */
 
995
                 * detection being hit
 
996
                 */
965
997
                d->last_loop_start_time = 0;
966
998
        }
967
999
 
968
1000
        if (status == DISPLAY_CHOSEN) {
969
 
                /* forget about this indirect id, since this
 
1001
                /*
 
1002
                 * Forget about this indirect id, since this
970
1003
                 * display will be dead very soon, and we don't want it
971
 
                 * to take the indirect display with it */
 
1004
                 * to take the indirect display with it
 
1005
                 */
972
1006
                d->indirect_id = 0;
973
1007
                status = DISPLAY_REMANAGE;
974
1008
        }
979
1013
                } else {
980
1014
                        d->try_different_greeter = FALSE;
981
1015
                }
982
 
                /* now just remanage */
 
1016
                /* Now just remanage */
983
1017
                status = DISPLAY_REMANAGE;
984
1018
        } else {
985
1019
                d->try_different_greeter = FALSE;
986
1020
        }
987
1021
 
988
 
        /* checkout if we can actually do stuff */
989
 
        switch (status) {
990
 
        case DISPLAY_REBOOT:
991
 
                if (gdm_daemon_config_get_value_string_array (GDM_KEY_REBOOT) == NULL)
992
 
                        status = DISPLAY_REMANAGE;
993
 
                break;
994
 
        case DISPLAY_HALT:
995
 
                if (gdm_daemon_config_get_value_string_array (GDM_KEY_HALT) == NULL)
996
 
                        status = DISPLAY_REMANAGE;
997
 
                break;
998
 
        case DISPLAY_SUSPEND:
999
 
                if (gdm_daemon_config_get_value_string_array (GDM_KEY_SUSPEND) == NULL)
1000
 
                        status = DISPLAY_REMANAGE;
1001
 
                break;
1002
 
        default:
1003
 
                break;
1004
 
        }
1005
 
 
1006
1022
        /* if we crashed clear the theme */
1007
1023
        if (crashed) {
1008
1024
                g_free (d->theme_name);
1034
1050
                goto start_autopsy;
1035
1051
                break;
1036
1052
 
1037
 
        case DISPLAY_HALT:              /* Halt machine */
 
1053
        case DISPLAY_HALT:      /* Halt machine */
1038
1054
                halt_machine ();
1039
1055
 
1040
1056
                status = DISPLAY_REMANAGE;
1077
1093
                                /* reset */
1078
1094
                                d->x_faileds = 1;
1079
1095
                                d->last_x_failed = now;
1080
 
                                /* well sleep at least 3 seconds before starting */
 
1096
                                /* Sleep at least 3 seconds before starting */
1081
1097
                                d->sleep_before_run = 3;
1082
1098
                        } else if (d->x_faileds >= 3) {
1083
1099
                                gdm_debug ("gdm_child_action: dealing with X crashes");
1084
1100
                                if ( ! deal_with_x_crashes (d)) {
1085
1101
                                        gdm_debug ("gdm_child_action: Aborting display");
1086
 
                                        /* an original way to deal with these things:
1087
 
                                         * "Screw you guys, I'm going home!" */
 
1102
                                        /*
 
1103
                                         * An original way to deal with these
 
1104
                                         * things:
 
1105
                                         * "Screw you guys, I'm going home!"
 
1106
                                         */
1088
1107
                                        gdm_display_unmanage (d);
1089
1108
 
1090
1109
                                        /* If there are some pending statics,
1095
1114
                                gdm_debug ("gdm_child_action: Trying again");
1096
1115
 
1097
1116
                                /* reset */
1098
 
                                d->x_faileds = 0;
 
1117
                                d->x_faileds     = 0;
1099
1118
                                d->last_x_failed = 0;
1100
1119
                        } else {
1101
 
                                /* well sleep at least 3 seconds before starting */
 
1120
                                /* Sleep at least 3 seconds before starting */
1102
1121
                                d->sleep_before_run = 3;
1103
1122
                        }
1104
 
                        /* go around the display loop detection, we're doing
1105
 
                         * our own here */
 
1123
                        /*
 
1124
                         * Go around the display loop detection, we are doing
 
1125
                         * our own here
 
1126
                         */
1106
1127
                        d->last_loop_start_time = 0;
1107
1128
                }
1108
1129
                /* fall through */
1111
1132
        default:
1112
1133
                gdm_debug ("gdm_child_action: In remanage");
1113
1134
 
1114
 
                /* if we did REMANAGE, that means that we're no longer failing */
 
1135
                /*
 
1136
                 * If we did REMANAGE, that means that we are no longer
 
1137
                 * failing.
 
1138
                 */
1115
1139
                if (status == DISPLAY_REMANAGE) {
1116
1140
                        /* reset */
1117
1141
                        d->x_faileds = 0;
1138
1162
                                gdm_start_first_unborn_local (3 /* delay */);
1139
1163
                        }
1140
1164
                } else if (d->type == TYPE_FLEXI || d->type == TYPE_FLEXI_XNEST) {
1141
 
                        /* if this was a chooser session and we have chosen a host,
1142
 
                           then we don't want to unmanage, we want to manage and
1143
 
                           choose that host */
 
1165
                        /*
 
1166
                         * If this was a chooser session and we have chosen a
 
1167
                         * host, then we don't want to unmanage, we want to
 
1168
                         * manage and choose that host
 
1169
                         */
1144
1170
                        if (d->chosen_hostname != NULL || d->use_chooser) {
1145
1171
                                if ( ! gdm_display_manage (d)) {
1146
1172
                                        gdm_display_unmanage (d);