summaryrefslogtreecommitdiff
path: root/community/tint2/zombie-fix.patch
blob: 48f767301f59d895a202bf1dcc5884849c1d4cf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
http://code.google.com/p/tint2/issues/detail?id=430
Submitted By: David B. Cortarello (Nomius) <dcortarello at gmail dot com>
Date: 18-05-2013
Initial Package Version: subversion trunk (revision 652)
Description: Fix zombie (defunct) processes created in clock_action.
This patch provides the following bugfixes:
   * This patch uses waitpid with WNOHANG to eliminate all zombie processes created by 
tint2 (in particular by the clock -right or left- click). This is done by a small hack 
in the update_clocks_min, called to "redraw" that area.

--- trunk/src/clock/clock.c	(revision 652)
+++ trunk/src/clock/clock.c	(working copy)
@@ -23,6 +23,8 @@
 #include <cairo-xlib.h>
 #include <pango/pangocairo.h>
 #include <stdlib.h>
+#include <sys/types.h>
+#include <sys/wait.h>
 
 #include "window.h"
 #include "server.h"
@@ -98,6 +103,10 @@
 	// remember old_sec because after suspend/hibernate the clock should be updated directly, and not
 	// on next minute change
 	time_t old_sec = time_clock.tv_sec;
+
+	// Little hack to wait executed commands in clock_action avoiding zombies
+	waitpid(-1, NULL, WNOHANG);
+
 	gettimeofday(&time_clock, 0);
 	if (time_clock.tv_sec % 60 == 0 || time_clock.tv_sec - old_sec > 60) {
 		int i;