summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/pseudo/files/shutdownping.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/pseudo/files/shutdownping.patch')
-rw-r--r--meta/recipes-devtools/pseudo/files/shutdownping.patch53
1 files changed, 53 insertions, 0 deletions
diff --git a/meta/recipes-devtools/pseudo/files/shutdownping.patch b/meta/recipes-devtools/pseudo/files/shutdownping.patch
new file mode 100644
index 0000000000..8af8e0b594
--- /dev/null
+++ b/meta/recipes-devtools/pseudo/files/shutdownping.patch
@@ -0,0 +1,53 @@
1There is a potential issue with the fastop code in pseudo since a process may
2exit and allow some other function to run before the server has processed
3the commands run by the process. Issues have been see with unpredictable
4file permissions.
5
6To avoid this, we ping the server before exitting which guarantees it has
7processed the current command queue.
8
9Debugged-by: RP
10Fix written by peter.seebach@windriver.com
11
12Upstream-Status: Submitted
13
14[YOCTO #5132]
15
16diff --git a/pseudo_client.c b/pseudo_client.c
17index f58ce4c..20943b6 100644
18--- a/pseudo_client.c
19+++ b/pseudo_client.c
20@@ -75,6 +75,9 @@ static int nfds = 0;
21 static int messages = 0;
22 static struct timeval message_time = { .tv_sec = 0 };
23 static int pseudo_inited = 0;
24+
25+static int sent_messages = 0;
26+
27 int pseudo_nosymlinkexp = 0;
28
29 /* note: these are int, not uid_t/gid_t, so I can use 'em with scanf */
30@@ -711,6 +714,11 @@ client_ping(void) {
31 return 0;
32 }
33
34+static void
35+void_client_ping(void) {
36+ client_ping();
37+}
38+
39 int
40 pseudo_fd(int fd, int how) {
41 int newfd;
42@@ -1043,6 +1051,11 @@ pseudo_client_op(pseudo_op_t op, int access, int fd, int dirfd, const char *path
43 /* disable wrappers */
44 pseudo_antimagic();
45
46+ if (!sent_messages) {
47+ sent_messages = 1;
48+ atexit(void_client_ping);
49+ }
50+
51 if (op == OP_RENAME) {
52 va_list ap;
53 va_start(ap, buf);