-rw-r--r-- | core/opie-login/main.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/opie-login/main.cpp b/core/opie-login/main.cpp index 8d0976f..6aa7287 100644 --- a/core/opie-login/main.cpp +++ b/core/opie-login/main.cpp | |||
@@ -119,97 +119,98 @@ int main ( int argc, char **argv ) | |||
119 | else if ( child > 0 ) { | 119 | else if ( child > 0 ) { |
120 | int status = 0; | 120 | int status = 0; |
121 | time_t started = ::time ( 0 ); | 121 | time_t started = ::time ( 0 ); |
122 | 122 | ||
123 | while ( ::waitpid ( child, &status, 0 ) < 0 ) { } | 123 | while ( ::waitpid ( child, &status, 0 ) < 0 ) { } |
124 | 124 | ||
125 | LoginApplication::logout ( ); | 125 | LoginApplication::logout ( ); |
126 | 126 | ||
127 | if (( ::time ( 0 ) - started ) < 3 ) { | 127 | if (( ::time ( 0 ) - started ) < 3 ) { |
128 | if ( autolog ) { | 128 | if ( autolog ) { |
129 | ::syslog ( LOG_ERR, "Respawning too fast -- disabling auto-login\n" ); | 129 | ::syslog ( LOG_ERR, "Respawning too fast -- disabling auto-login\n" ); |
130 | autolog = 0; | 130 | autolog = 0; |
131 | } | 131 | } |
132 | else { | 132 | else { |
133 | ::syslog ( LOG_ERR, "Respawning too fast -- going down\n" ); | 133 | ::syslog ( LOG_ERR, "Respawning too fast -- going down\n" ); |
134 | break; | 134 | break; |
135 | } | 135 | } |
136 | } | 136 | } |
137 | int killedbysig = 0; | 137 | int killedbysig = 0; |
138 | userExited=0; | 138 | userExited=0; |
139 | if (WIFEXITED(status)!=0 ) { | 139 | if (WIFEXITED(status)!=0 ) { |
140 | if (WEXITSTATUS(status)==137) { | 140 | if (WEXITSTATUS(status)==137) { |
141 | userExited=1; | 141 | userExited=1; |
142 | } | 142 | } |
143 | } | 143 | } |
144 | 144 | ||
145 | if ( WIFSIGNALED( status )) { | 145 | if ( WIFSIGNALED( status )) { |
146 | switch ( WTERMSIG( status )) { | 146 | switch ( WTERMSIG( status )) { |
147 | case SIGTERM: | 147 | case SIGTERM: |
148 | case SIGINT : | 148 | case SIGINT : |
149 | case SIGKILL: | 149 | case SIGKILL: |
150 | break; | 150 | break; |
151 | 151 | ||
152 | default : | 152 | default : |
153 | killedbysig = WTERMSIG( status ); | 153 | killedbysig = WTERMSIG( status ); |
154 | break; | 154 | break; |
155 | } | 155 | } |
156 | } | 156 | } |
157 | if ( killedbysig ) { // qpe was killed by an uncaught signal | 157 | if ( killedbysig ) { // qpe was killed by an uncaught signal |
158 | qApp = 0; | 158 | qApp = 0; |
159 | 159 | ||
160 | ::syslog ( LOG_ERR, "Opie was killed by a signal #%d", killedbysig ); | 160 | ::syslog ( LOG_ERR, "Opie was killed by a signal #%d", killedbysig ); |
161 | 161 | ||
162 | QWSServer::setDesktopBackground ( QImage ( )); | 162 | QWSServer::setDesktopBackground ( QImage ( )); |
163 | QApplication *app = new QApplication ( argc, argv, QApplication::GuiServer ); | 163 | QApplication *app = new QApplication ( argc, argv, QApplication::GuiServer ); |
164 | app-> setFont ( QFont ( "Helvetica", 10 )); | 164 | app-> setFont ( QFont ( "Helvetica", 10 )); |
165 | app-> setStyle ( new QPEStyle ( )); | 165 | app-> setStyle ( new QPEStyle ( )); |
166 | 166 | ||
167 | const char *sig = ::strsignal ( killedbysig ); | 167 | // const char *sig = ::strsignal ( killedbysig ); |
168 | const char *sig = ::sys_siglist[killedbysig]; | ||
168 | QLabel *l = new QLabel ( 0, "sig", Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_Tool ); | 169 | QLabel *l = new QLabel ( 0, "sig", Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_Tool ); |
169 | l-> setText ( LoginWindowImpl::tr( "Opie was terminated\nby an uncaught signal\n(%1)\n" ). arg ( sig )); | 170 | l-> setText ( LoginWindowImpl::tr( "Opie was terminated\nby an uncaught signal\n(%1)\n" ). arg ( sig )); |
170 | l-> setAlignment ( Qt::AlignCenter ); | 171 | l-> setAlignment ( Qt::AlignCenter ); |
171 | l-> move ( 0, 0 ); | 172 | l-> move ( 0, 0 ); |
172 | l-> resize ( app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( )); | 173 | l-> resize ( app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( )); |
173 | l-> show ( ); | 174 | l-> show ( ); |
174 | QTimer::singleShot ( 3000, app, SLOT( quit())); | 175 | QTimer::singleShot ( 3000, app, SLOT( quit())); |
175 | app-> exec ( ); | 176 | app-> exec ( ); |
176 | delete app; | 177 | delete app; |
177 | qApp = 0; | 178 | qApp = 0; |
178 | } | 179 | } |
179 | } | 180 | } |
180 | else { | 181 | else { |
181 | if ( !autolog ) { | 182 | if ( !autolog ) { |
182 | QString confFile=QPEApplication::qpeDir() + "/etc/opie-login.conf"; | 183 | QString confFile=QPEApplication::qpeDir() + "/etc/opie-login.conf"; |
183 | Config cfg ( confFile, Config::File ); | 184 | Config cfg ( confFile, Config::File ); |
184 | cfg. setGroup ( "General" ); | 185 | cfg. setGroup ( "General" ); |
185 | QString user = cfg. readEntry ( "AutoLogin" ); | 186 | QString user = cfg. readEntry ( "AutoLogin" ); |
186 | 187 | ||
187 | if ( !user. isEmpty ( )) | 188 | if ( !user. isEmpty ( )) |
188 | autolog = ::strdup ( user. latin1 ( )); | 189 | autolog = ::strdup ( user. latin1 ( )); |
189 | } | 190 | } |
190 | 191 | ||
191 | if ( autolog && !userExited ) { | 192 | if ( autolog && !userExited ) { |
192 | 193 | ||
193 | QWSServer::setDesktopBackground( QImage() ); | 194 | QWSServer::setDesktopBackground( QImage() ); |
194 | ODevice::inst ( )-> setDisplayStatus ( true ); | 195 | ODevice::inst ( )-> setDisplayStatus ( true ); |
195 | ODevice::inst ( )-> setSoftSuspend ( false ); | 196 | ODevice::inst ( )-> setSoftSuspend ( false ); |
196 | LoginApplication *app = new LoginApplication ( argc, argv, ppid ); | 197 | LoginApplication *app = new LoginApplication ( argc, argv, ppid ); |
197 | LoginApplication::setLoginAs ( autolog ); | 198 | LoginApplication::setLoginAs ( autolog ); |
198 | 199 | ||
199 | 200 | ||
200 | if ( LoginApplication::changeIdentity ( )) | 201 | if ( LoginApplication::changeIdentity ( )) |
201 | ::exit ( LoginApplication::login ( )); | 202 | ::exit ( LoginApplication::login ( )); |
202 | else | 203 | else |
203 | ::exit ( 0 ); | 204 | ::exit ( 0 ); |
204 | } | 205 | } |
205 | else { | 206 | else { |
206 | ::exit ( login_main ( argc, argv, ppid )); | 207 | ::exit ( login_main ( argc, argv, ppid )); |
207 | } | 208 | } |
208 | } | 209 | } |
209 | } | 210 | } |
210 | return 0; | 211 | return 0; |
211 | } | 212 | } |
212 | 213 | ||
213 | void sigterm ( int /*sig*/ ) | 214 | void sigterm ( int /*sig*/ ) |
214 | { | 215 | { |
215 | ::exit ( 0 ); | 216 | ::exit ( 0 ); |