[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdelibs/kdesu
From:       Waldo Bastian <bastian () kde ! org>
Date:       2003-10-14 11:09:50
[Download RAW message or body]

CVS commit by waba: 

* Make kdesu work again on Linux
* Restore BC


  M +9 -4      process.cpp   1.37
  M +2 -2      process.h   1.31
  M +5 -6      su.cpp   1.30
  M +3 -3      su.h   1.16


--- kdelibs/kdesu/process.cpp  #1.36:1.37
@@ -104,4 +103,5 @@ int PtyProcess::checkPidExited(pid_t pid
                 if (WIFEXITED(state))
                         return WEXITSTATUS(state);
+                return Killed;
         }
 
@@ -450,5 +450,5 @@ int PtyProcess::waitForChild()
 
         ret = checkPidExited(m_Pid);
-        if (ret == -1)
+        if (ret == Error)
         {
                 if (errno == ECHILD) retval = 0;
@@ -456,5 +456,10 @@ int PtyProcess::waitForChild()
                 break;
         }
-        else if (ret == -2)
+        else if (ret == Killed)
+        {
+                retval = 0;
+                break;
+        }
+        else if (ret == NotExited)
         {
                 // keep checking

--- kdelibs/kdesu/process.h  #1.30:1.31
@@ -150,5 +150,5 @@ public /* static */:
     ** If child @p has not exited, return -2.
     */
-    enum checkPidStatus { Error=-1, NotExited=-2 } ;
+    enum checkPidStatus { Error=-1, NotExited=-2, Killed=-3 } ;
     static int checkPidExited(pid_t pid);
 

--- kdelibs/kdesu/su.cpp  #1.29:1.30
@@ -69,5 +69,5 @@ int SuProcess::checkNeedPassword()
  */
 
-int SuProcess::exec(const char *password, checkMode check)
+int SuProcess::exec(const char *password, int check)
 {
     if (check)
@@ -97,5 +97,5 @@ int SuProcess::exec(const char *password
     kdDebug(900) << k_lineinfo << "Done StubProcess::exec()" << endl;
     
-    SuErrors ret = ConverseSU(password);
+    SuErrors ret = (SuErrors) ConverseSU(password);
     kdDebug(900) << k_lineinfo << "Conversation returned " << ret << endl;
 
@@ -113,6 +113,5 @@ int SuProcess::exec(const char *password
             else 
             {
-                waitForChild();
-                int iret = checkPidExited(m_Pid) ;
+                int iret = waitForChild();
                 if (iret < 0) ret=error;
                 else /* nothing */ {} ;
@@ -164,5 +163,5 @@ int SuProcess::exec(const char *password
  */
 
-SuProcess::SuErrors SuProcess::ConverseSU(const char *password)
+int SuProcess::ConverseSU(const char *password)
 {       
     enum { WaitForPrompt, CheckStar, HandleStub } state = WaitForPrompt;

--- kdelibs/kdesu/su.h  #1.15:1.16
@@ -34,5 +34,5 @@ public:
      */
     enum checkMode { NoCheck=0, Install=1, NeedPassword=2 } ;
-    int exec(const char *password, checkMode check=NoCheck);
+    int exec(const char *password, int check=NoCheck);
 
     /** 
@@ -49,5 +49,5 @@ public:
 private:
     enum SuErrors { error=-1, ok=0, killme=1, notauthorized=2 } ;
-    SuErrors ConverseSU(const char *password);
+    int ConverseSU(const char *password);
 
 protected:


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic