[systemd-commits] src/gnome-ask-password-agent.vala

Colin Walters walters at kemper.freedesktop.org
Wed Aug 14 10:36:12 PDT 2013


 src/gnome-ask-password-agent.vala |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit b4063d4e8e0fbbfdb67bce5a7422f11fba8b6893
Author: Michael Laß <bevan at bi-co.net>
Date:   Wed Aug 14 06:46:24 2013 +0200

    gnome-ask-password-agent: do not double fork spawned process
    
    pkexec does not like being a lonely child:
    "Refusing to render service to dead parents."
    
    Do not double fork when spawning the process by using the DO_NOT_REAP_CHILD
    flag. Clean up manually using a child watch.

diff --git a/src/gnome-ask-password-agent.vala b/src/gnome-ask-password-agent.vala
index 0f6284d..8a5346d 100644
--- a/src/gnome-ask-password-agent.vala
+++ b/src/gnome-ask-password-agent.vala
@@ -213,6 +213,7 @@ public class MyStatusIcon : StatusIcon {
                     result == ResponseType.DELETE_EVENT)
                         return;
 
+                Pid child_pid;
                 int to_process;
 
                 try {
@@ -220,12 +221,15 @@ public class MyStatusIcon : StatusIcon {
                                         null,
                                         { "/usr/bin/pkexec", "/lib/systemd/systemd-reply-password", result == ResponseType.OK ? "1" : "0", socket },
                                         null,
-                                        0,
-                                        null,
+                                        SpawnFlags.DO_NOT_REAP_CHILD,
                                         null,
+                                        out child_pid,
                                         out to_process,
                                         null,
                                         null);
+                        ChildWatch.add(child_pid, (pid, status) => {
+                                Process.close_pid(pid);
+                        });
 
                         OutputStream stream = new UnixOutputStream(to_process, true);
 #if VALA_0_12



More information about the systemd-commits mailing list