summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/opie-login/loginapplication.cpp5
-rw-r--r--core/opie-login/loginapplication.h5
-rw-r--r--core/opie-login/main.cpp11
3 files changed, 14 insertions, 7 deletions
diff --git a/core/opie-login/loginapplication.cpp b/core/opie-login/loginapplication.cpp
index 103d63b..8d86a71 100644
--- a/core/opie-login/loginapplication.cpp
+++ b/core/opie-login/loginapplication.cpp
@@ -43,12 +43,13 @@ extern "C" {
#include "loginapplication.h"
LoginApplication *lApp;
-LoginApplication::LoginApplication ( int &argc, char **argv )
+LoginApplication::LoginApplication ( int &argc, char **argv, pid_t parentpid )
: QPEApplication ( argc, argv, GuiServer )
{
lApp = this;
+ m_parentpid = parentpid;
}
const char *LoginApplication::s_username = 0;
@@ -215,6 +216,6 @@ QStringList LoginApplication::allUsers ( )
void LoginApplication::quitToConsole ( )
{
QPEApplication::quit ( );
- ::kill ( ::getppid ( ), SIGTERM );
+ ::kill ( m_parentpid, SIGTERM );
}
diff --git a/core/opie-login/loginapplication.h b/core/opie-login/loginapplication.h
index 062c088..4e7cf79 100644
--- a/core/opie-login/loginapplication.h
+++ b/core/opie-login/loginapplication.h
@@ -38,9 +38,9 @@ struct pam_response;
#endif
class LoginApplication : public QPEApplication {
public:
- LoginApplication ( int &argc, char **argv );
+ LoginApplication ( int &argc, char **argv, pid_t parentpid );
static bool checkPassword ( const char *user, const char *password );
static const char *loginAs ( );
@@ -59,8 +59,11 @@ private:
#ifdef USEPAM
static int pam_helper ( int num_msg, const struct pam_message **msg, struct pam_response **resp, void * );
static const char *s_pam_password;
#endif
+
+private:
+ pid_t m_parentpid;
};
extern LoginApplication *lApp;
diff --git a/core/opie-login/main.cpp b/core/opie-login/main.cpp
index 579a93a..674829d 100644
--- a/core/opie-login/main.cpp
+++ b/core/opie-login/main.cpp
@@ -59,9 +59,9 @@
#include "calibrate.h"
using namespace Opie;
-int login_main ( int argc, char **argv );
+int login_main ( int argc, char **argv, pid_t ppid );
void sigterm ( int sig );
void exit_closelog ( );
static struct option long_options [] = {
@@ -71,8 +71,11 @@ static struct option long_options [] = {
int main ( int argc, char **argv )
{
+ pid_t ppid = ::getpid ( );
+
+
if ( ::geteuid ( ) != 0 ) {
::fprintf ( stderr, "%s can only be executed by root. (or chmod +s)", argv [0] );
return 1;
}
@@ -182,9 +185,9 @@ int main ( int argc, char **argv )
else
::exit ( 0 );
}
else
- ::exit ( login_main ( argc, argv ));
+ ::exit ( login_main ( argc, argv, ppid ));
}
}
return 0;
}
@@ -301,12 +304,12 @@ private:
-int login_main ( int argc, char **argv )
+int login_main ( int argc, char **argv, pid_t ppid )
{
QWSServer::setDesktopBackground( QImage() );
- LoginApplication *app = new LoginApplication ( argc, argv );
+ LoginApplication *app = new LoginApplication ( argc, argv, ppid );
app-> setFont ( QFont ( "Helvetica", 10 ));
app-> setStyle ( new QPEStyle ( ));