summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Endrodi <ext-adam.endrodi@nokia.com>2010-10-28 14:45:03 +0300
committerAdam Endrodi <ext-adam.endrodi@nokia.com>2010-10-28 14:45:03 +0300
commit934d8699a5e96642685502b8c82f1c6fc28365d6 (patch)
tree373761f177de015081a77c9cb7f9af24ead16b94
parentafdcf240324d656aba547bcf50214505a4209d3f (diff)
don't launch a new XServerPinger upon restart
-rw-r--r--mcompositor/xserverpinger.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/mcompositor/xserverpinger.cpp b/mcompositor/xserverpinger.cpp
index 76897b8..654cf39 100644
--- a/mcompositor/xserverpinger.cpp
+++ b/mcompositor/xserverpinger.cpp
@@ -68,13 +68,20 @@ void XServerPinger::tick()
qWarning("X is on holidays");
}
-// Start a new process and let our parent (the real mcompositor) go.
-// Die with the parent.
+// Start XServerPinger in a separate process if it's not running yet.
static void altmain() __attribute__((constructor));
static void altmain()
{
+ // Don't run again if the parent restarted.
+ if (getenv("XSERVERPINGER"))
+ return;
+ putenv("XSERVERPINGER=1");
+
+ // Start a new process and let our parent (the real mcompositor) go.
if (fork())
return;
+
+ // Die with the parent.
prctl(PR_SET_PDEATHSIG, SIGKILL);
int meh = 0;