summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Laß <bevan@bi-co.net>2013-08-14 06:46:24 +0200
committerColin Walters <walters@verbum.org>2013-08-14 19:35:57 +0200
commitb4063d4e8e0fbbfdb67bce5a7422f11fba8b6893 (patch)
tree8d736a058870dff1f2a1a6201e3a5825b6a8954f
parent7245ad7bd9e5caafafe9162f54fa527859eaf6ca (diff)
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.
-rw-r--r--src/gnome-ask-password-agent.vala8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gnome-ask-password-agent.vala b/src/gnome-ask-password-agent.vala
index 0f6284dc..8a5346d3 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