summaryrefslogtreecommitdiffstats
path: root/meta/packages/clipboard-manager/files/daemonize.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/clipboard-manager/files/daemonize.patch')
-rw-r--r--meta/packages/clipboard-manager/files/daemonize.patch44
1 files changed, 44 insertions, 0 deletions
diff --git a/meta/packages/clipboard-manager/files/daemonize.patch b/meta/packages/clipboard-manager/files/daemonize.patch
new file mode 100644
index 0000000000..51ce4781a5
--- /dev/null
+++ b/meta/packages/clipboard-manager/files/daemonize.patch
@@ -0,0 +1,44 @@
1Index: 0.6.4/manager.c
2===================================================================
3--- 0.6.4.orig/manager.c 2007-06-28 12:23:37.000000000 +0100
4+++ 0.6.4/manager.c 2007-06-28 12:36:14.000000000 +0100
5@@ -68,7 +68,8 @@
6 ClipboardManager *manager;
7 int terminated = False;
8 Display *display;
9-
10+ pid_t pid;
11+
12 display = XOpenDisplay (NULL);
13
14 if (!display)
15@@ -83,6 +84,29 @@
16 exit (1);
17 }
18
19+ /* deamonize */
20+ pid = fork();
21+ switch (pid)
22+ {
23+ case -1: fprintf (stderr, "Fork failed.\n");
24+ /* Fall through */
25+ default: exit(0); break;
26+ case 0: break;
27+ }
28+
29+ chdir ("/");
30+ setsid ();
31+ umask (0);
32+
33+ pid = fork();
34+ switch (pid)
35+ {
36+ case -1: fprintf (stderr, "Fork failed.\n");
37+ /* Fall through */
38+ default: exit(0); break;
39+ case 0: break;
40+ }
41+
42 XSetErrorHandler (x_error);
43 manager = clipboard_manager_new (display,
44 error_trap_push, error_trap_pop,