PolicyKit: Branch 'master'

David Zeuthen david at kemper.freedesktop.org
Mon Jul 30 16:31:05 PDT 2007


 polkit-grant/polkit-grant.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletion(-)

New commits:
diff-tree 1f90f7e15095b9fdd0374fef98fbb3241a2b2ad6 (from 6e2d74cb86e529ab8ec964d6a0f632535fc78a9c)
Author: David Zeuthen <davidz at redhat.com>
Date:   Mon Jul 30 19:29:47 2007 -0400

    use waitpid() to avoid Zombie processes

diff --git a/polkit-grant/polkit-grant.c b/polkit-grant/polkit-grant.c
index b4f6bf0..1217217 100644
--- a/polkit-grant/polkit-grant.c
+++ b/polkit-grant/polkit-grant.c
@@ -138,7 +138,9 @@ polkit_grant_unref (PolKitGrant *polkit_
                 polkit_grant->func_remove_watch (polkit_grant, polkit_grant->child_watch_id);
         }
         if (polkit_grant->child_pid > 0) {
+                int status;
                 kill (polkit_grant->child_pid, SIGTERM);
+                waitpid (polkit_grant->child_pid, &status, 0);
         }
         if (polkit_grant->child_stdout_f != NULL) {
                 fclose (polkit_grant->child_stdout_f);
@@ -221,10 +223,15 @@ polkit_grant_set_functions (PolKitGrant 
 void
 polkit_grant_child_func (PolKitGrant *polkit_grant, pid_t pid, int exit_code)
 {
+        int status;
         polkit_bool_t input_was_bogus;
+
         g_return_if_fail (polkit_grant != NULL);
         g_return_if_fail (polkit_grant->auth_in_progress);
 
+        g_debug ("pid %d terminated", pid);
+        waitpid (pid, &status, 0);
+
         if (exit_code >= 2)
                 input_was_bogus = TRUE;
         else
@@ -361,8 +368,11 @@ polkit_grant_cancel_auth (PolKitGrant *p
 
         pid = polkit_grant->child_pid;
         polkit_grant->child_pid = 0;
-        if (pid > 0)
+        if (pid > 0) {
+                int status;
                 kill (pid, SIGTERM);
+                waitpid (pid, &status, 0);
+        }
         polkit_grant->func_done (polkit_grant, FALSE, FALSE, polkit_grant->user_data);        
 }
 


More information about the hal-commit mailing list