summaryrefslogtreecommitdiff
path: root/core/opie-login/main.cpp
authorzecke <zecke>2003-10-04 07:28:05 (UTC)
committer zecke <zecke>2003-10-04 07:28:05 (UTC)
commit23f729eb7487ad189591c3b0c9af9d3afecd3b91 (patch) (side-by-side diff)
tree83b7efa5996ffcbf22f36b370505eb11fdece4ff /core/opie-login/main.cpp
parent364d30ca7c212a531b79bb7cbceb8af7a0130f2c (diff)
downloadopie-23f729eb7487ad189591c3b0c9af9d3afecd3b91.zip
opie-23f729eb7487ad189591c3b0c9af9d3afecd3b91.tar.gz
opie-23f729eb7487ad189591c3b0c9af9d3afecd3b91.tar.bz2
Avoid crashing on no mouse driver
Diffstat (limited to 'core/opie-login/main.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/opie-login/main.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/core/opie-login/main.cpp b/core/opie-login/main.cpp
index 7dcb5f6..2103216 100644
--- a/core/opie-login/main.cpp
+++ b/core/opie-login/main.cpp
@@ -98,25 +98,25 @@ int main ( int argc, char **argv )
}
}
// struct rlimit rl;
// ::getrlimit ( RLIMIT_NOFILE, &rl );
// for ( unsigned int i = 0; i < rl. rlim_cur; i++ )
// ::close ( i );
::setpgid ( 0, 0 );
::setsid ( );
- ::signal ( SIGTERM, sigterm );
+ ::signal ( SIGTERM, sigterm );
::signal ( SIGINT, sigterm );
::openlog ( "opie-login", LOG_CONS, LOG_AUTHPRIV );
::atexit ( exit_closelog );
while ( true ) {
pid_t child = ::fork ( );
if ( child < 0 ) {
::syslog ( LOG_ERR, "Could not fork GUI process\n" );
break;
}
@@ -151,25 +151,25 @@ int main ( int argc, char **argv )
case SIGTERM:
case SIGINT :
case SIGKILL:
break;
default :
killedbysig = WTERMSIG( status );
break;
}
}
if ( killedbysig ) { // qpe was killed by an uncaught signal
qApp = 0;
-
+
::syslog ( LOG_ERR, "Opie was killed by a signal #%d", killedbysig );
QWSServer::setDesktopBackground ( QImage ( ));
QApplication *app = new QApplication ( argc, argv, QApplication::GuiServer );
app-> setFont ( QFont ( "Helvetica", 10 ));
app-> setStyle ( new QPEStyle ( ));
const char *sig = ::strsignal ( killedbysig );
QLabel *l = new QLabel ( 0, "sig", Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_Tool );
l-> setText ( LoginWindowImpl::tr( "Opie was terminated\nby an uncaught signal\n(%1)\n" ). arg ( sig ));
l-> setAlignment ( Qt::AlignCenter );
l-> move ( 0, 0 );
@@ -178,37 +178,37 @@ int main ( int argc, char **argv )
QTimer::singleShot ( 3000, app, SLOT( quit ( )));
app-> exec ( );
delete app;
qApp = 0;
}
}
else {
if ( !autolog ) {
QString confFile=QPEApplication::qpeDir() + "/etc/opie-login.conf";
Config cfg ( confFile, Config::File );
cfg. setGroup ( "General" );
QString user = cfg. readEntry ( "AutoLogin" );
-
+
if ( !user. isEmpty ( ))
autolog = ::strdup ( user. latin1 ( ));
}
-
+
if ( autolog && !userExited ) {
QWSServer::setDesktopBackground( QImage() );
ODevice::inst ( )-> setDisplayStatus ( true );
ODevice::inst ( )-> setSoftSuspend ( false );
LoginApplication *app = new LoginApplication ( argc, argv, ppid );
LoginApplication::setLoginAs ( autolog );
-
+
if ( LoginApplication::changeIdentity ( ))
::exit ( LoginApplication::login ( ));
else
::exit ( 0 );
}
else {
::exit ( login_main ( argc, argv, ppid ));
}
}
}
return 0;
@@ -331,25 +331,26 @@ namespace Opie { extern int force_appearance; } // HACK to get around the force
int login_main ( int argc, char **argv, pid_t ppid )
{
QWSServer::setDesktopBackground( QImage() );
LoginApplication *app = new LoginApplication ( argc, argv, ppid );
Opie::force_appearance = 0;
app-> setFont ( QFont ( "Helvetica", 10 ));
app-> setStyle ( new QPEStyle ( ));
ODevice::inst ( )-> setSoftSuspend ( true );
- if ( QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) {
+ if ( QWSServer::mouseHandler() &&
+ QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) {
if ( !QFile::exists ( "/etc/pointercal" )) {
// Make sure calibration widget starts on top.
Calibrate *cal = new Calibrate;
cal-> exec ( );
delete cal;
}
}
LoginScreenSaver *saver = new LoginScreenSaver;
saver-> setIntervals ( );
QWSServer::setScreenSaver ( saver );