diff options
Diffstat (limited to 'meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open-failure-in-chroot-env.patch')
-rw-r--r-- | meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open-failure-in-chroot-env.patch | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open-failure-in-chroot-env.patch b/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open-failure-in-chroot-env.patch new file mode 100644 index 0000000000..4fa3d184ed --- /dev/null +++ b/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open-failure-in-chroot-env.patch | |||
@@ -0,0 +1,46 @@ | |||
1 | Upstream-Status: Inappropriate [OE specific] | ||
2 | |||
3 | commonio.c: fix unexpected open failure in chroot environment | ||
4 | |||
5 | When using commands with '-R <newroot>' option in our pseudo environment, | ||
6 | we would usually get the 'Pemission Denied' error. This patch serves as | ||
7 | a workaround to this problem. | ||
8 | |||
9 | Note that this patch doesn't change the logic in the code, it just expands | ||
10 | the codes. | ||
11 | |||
12 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
13 | --- | ||
14 | lib/commonio.c | 16 ++++++++++++---- | ||
15 | 1 file changed, 12 insertions(+), 4 deletions(-) | ||
16 | |||
17 | diff --git a/lib/commonio.c b/lib/commonio.c | ||
18 | index cc536bf..51cafd9 100644 | ||
19 | --- a/lib/commonio.c | ||
20 | +++ b/lib/commonio.c | ||
21 | @@ -613,10 +613,18 @@ int commonio_open (struct commonio_db *db, int mode) | ||
22 | db->cursor = NULL; | ||
23 | db->changed = false; | ||
24 | |||
25 | - fd = open (db->filename, | ||
26 | - (db->readonly ? O_RDONLY : O_RDWR) | ||
27 | - | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW); | ||
28 | - saved_errno = errno; | ||
29 | + if (db->readonly) { | ||
30 | + fd = open (db->filename, | ||
31 | + (true ? O_RDONLY : O_RDWR) | ||
32 | + | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW); | ||
33 | + saved_errno = errno; | ||
34 | + } else { | ||
35 | + fd = open (db->filename, | ||
36 | + (false ? O_RDONLY : O_RDWR) | ||
37 | + | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW); | ||
38 | + saved_errno = errno; | ||
39 | + } | ||
40 | + | ||
41 | db->fp = NULL; | ||
42 | if (fd >= 0) { | ||
43 | #ifdef WITH_TCB | ||
44 | -- | ||
45 | 1.7.9.5 | ||
46 | |||