File: 10-osdsh-create-fifo-before-fork.patch

package info (click to toggle)
osdsh 0.7.0-12
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 568 kB
  • sloc: ansic: 1,064; tcl: 335; makefile: 69
file content (49 lines) | stat: -rw-r--r-- 1,332 bytes parent folder | download | duplicates (3)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
From: Peter Colberg <peterco@gmx.net>
Date: Mon, 7 Jan 2019 13:12:45 +0100
Subject: No description.

---
 src/osdsh/controlsh.c | 4 ----
 src/osdsh/osdsh.c     | 7 +++++++
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/osdsh/controlsh.c b/src/osdsh/controlsh.c
index e73a24a..da00aa4 100644
--- a/src/osdsh/controlsh.c
+++ b/src/osdsh/controlsh.c
@@ -213,10 +213,6 @@ void *control_sh(void *arg)
 	initialize_osd(&settings);
 	load_basic_plugins();
 
-    /* create the fifo file*/
-	unlink(fifo_file);
-	umask(0);
-	mknod(fifo_file, S_IFIFO|0600, 0);
 	    /*open and read the fifo*/
 	while (settings.displaying) {
 		fp = fopen(fifo_file, "r");
diff --git a/src/osdsh/osdsh.c b/src/osdsh/osdsh.c
index e6e00b7..269afd7 100644
--- a/src/osdsh/osdsh.c
+++ b/src/osdsh/osdsh.c
@@ -153,6 +153,7 @@ int main(int argc, char *argv[], char *env[])
 
     char pid_file[PATH_MAX+1];
     FILE *fp;
+    char fifo_file[PATH_MAX +1];
 
     set_defaults(&settings);
     initialize_osd(&settings);
@@ -180,6 +181,12 @@ int main(int argc, char *argv[], char *env[])
 	fclose(fp);
     }
 
+    /* create the fifo file*/
+    sprintf(fifo_file, "%s.%d", OSD_FIFO_PATH, getuid());
+    unlink(fifo_file);
+    umask(0);
+    mknod(fifo_file, S_IFIFO|0600, 0);
+
     if((childpid=fork())<0) {
 	perror("fork");
 	exit(1);