diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-09-26 17:01:29 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-09-30 22:56:19 +0100 |
commit | a1d9b6df86b0829d591cae57ae351f6d96e63557 (patch) | |
tree | 960bc4197fe047a24a3b64c1d4aeb0038f405d34 /meta/recipes-devtools/pseudo/files | |
parent | b43c8126def45bb28f89322ad648f555b0f15464 (diff) | |
download | poky-a1d9b6df86b0829d591cae57ae351f6d96e63557.tar.gz |
pseudo: Fix race problems
There is a potential issue with the fastop code in pseudo since a process may
exit and allow some other function to run before the server has processed
the commands run by the process. Issues have been see with unpredictable
file permissions.
To avoid this, we ping the server before exitting which guarantees it has
processed the current command queue.
The patch was written by peter.seebach@windriver.com
[YOCTO #5132]
(From OE-Core rev: a8a1f12c51ffdca011db194894fd7d14c119fb09)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/pseudo/files')
-rw-r--r-- | meta/recipes-devtools/pseudo/files/shutdownping.patch | 53 |
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 @@ | |||
1 | There is a potential issue with the fastop code in pseudo since a process may | ||
2 | exit and allow some other function to run before the server has processed | ||
3 | the commands run by the process. Issues have been see with unpredictable | ||
4 | file permissions. | ||
5 | |||
6 | To avoid this, we ping the server before exitting which guarantees it has | ||
7 | processed the current command queue. | ||
8 | |||
9 | Debugged-by: RP | ||
10 | Fix written by peter.seebach@windriver.com | ||
11 | |||
12 | Upstream-Status: Submitted | ||
13 | |||
14 | [YOCTO #5132] | ||
15 | |||
16 | diff --git a/pseudo_client.c b/pseudo_client.c | ||
17 | index 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); | ||