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 | 16 |
1 files changed, 9 insertions, 7 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 index 85d9175105..4a932d2dbb 100644 --- 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 | |||
@@ -1,4 +1,4 @@ | |||
1 | From 21583da072aa66901d859ac00ce209bac87ddecc Mon Sep 17 00:00:00 2001 | 1 | From a773c6b240d27e23d6be41decef0edf24fcee523 Mon Sep 17 00:00:00 2001 |
2 | From: Chen Qi <Qi.Chen@windriver.com> | 2 | From: Chen Qi <Qi.Chen@windriver.com> |
3 | Date: Thu, 17 Jul 2014 15:53:34 +0800 | 3 | Date: Thu, 17 Jul 2014 15:53:34 +0800 |
4 | Subject: [PATCH] commonio.c-fix-unexpected-open-failure-in-chroot-env | 4 | Subject: [PATCH] commonio.c-fix-unexpected-open-failure-in-chroot-env |
@@ -15,35 +15,37 @@ Note that this patch doesn't change the logic in the code, it just expands | |||
15 | the codes. | 15 | the codes. |
16 | 16 | ||
17 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | 17 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> |
18 | |||
19 | --- | 18 | --- |
20 | lib/commonio.c | 16 ++++++++++++---- | 19 | lib/commonio.c | 16 ++++++++++++---- |
21 | 1 file changed, 12 insertions(+), 4 deletions(-) | 20 | 1 file changed, 12 insertions(+), 4 deletions(-) |
22 | 21 | ||
23 | diff --git a/lib/commonio.c b/lib/commonio.c | 22 | diff --git a/lib/commonio.c b/lib/commonio.c |
24 | index 9a02ce1..61384ec 100644 | 23 | index 73fdb3a..d1231e9 100644 |
25 | --- a/lib/commonio.c | 24 | --- a/lib/commonio.c |
26 | +++ b/lib/commonio.c | 25 | +++ b/lib/commonio.c |
27 | @@ -616,10 +616,18 @@ int commonio_open (struct commonio_db *db, int mode) | 26 | @@ -606,10 +606,18 @@ int commonio_open (struct commonio_db *db, int mode) |
28 | db->cursor = NULL; | 27 | db->cursor = NULL; |
29 | db->changed = false; | 28 | db->changed = false; |
30 | 29 | ||
31 | - fd = open (db->filename, | 30 | - fd = open (db->filename, |
32 | - (db->readonly ? O_RDONLY : O_RDWR) | 31 | - (db->readonly ? O_RDONLY : O_RDWR) |
33 | - | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW); | 32 | - | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW | O_CLOEXEC); |
34 | - saved_errno = errno; | 33 | - saved_errno = errno; |
35 | + if (db->readonly) { | 34 | + if (db->readonly) { |
36 | + fd = open (db->filename, | 35 | + fd = open (db->filename, |
37 | + (true ? O_RDONLY : O_RDWR) | 36 | + (true ? O_RDONLY : O_RDWR) |
38 | + | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW); | 37 | + | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW | O_CLOEXEC); |
39 | + saved_errno = errno; | 38 | + saved_errno = errno; |
40 | + } else { | 39 | + } else { |
41 | + fd = open (db->filename, | 40 | + fd = open (db->filename, |
42 | + (false ? O_RDONLY : O_RDWR) | 41 | + (false ? O_RDONLY : O_RDWR) |
43 | + | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW); | 42 | + | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW| O_CLOEXEC); |
44 | + saved_errno = errno; | 43 | + saved_errno = errno; |
45 | + } | 44 | + } |
46 | + | 45 | + |
47 | db->fp = NULL; | 46 | db->fp = NULL; |
48 | if (fd >= 0) { | 47 | if (fd >= 0) { |
49 | #ifdef WITH_TCB | 48 | #ifdef WITH_TCB |
49 | -- | ||
50 | 2.30.2 | ||
51 | |||