summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/rpm/rpm/rpmdb-prevent-race-in-tmpdir-creation.patch
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2016-10-14 13:41:26 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-11-08 23:47:13 +0000
commit6962ee368906e096cf2df3031ca5142117e7c52a (patch)
treef1c63d713bcc10cb30256c9655d1c1d5164eee4a /meta/recipes-devtools/rpm/rpm/rpmdb-prevent-race-in-tmpdir-creation.patch
parent191666022aec6105296a7cead4ee5dc892c288cd (diff)
downloadpoky-6962ee368906e096cf2df3031ca5142117e7c52a.tar.gz
rpm: prevent race in tempdir creation
This patch fixes an extramely rare race condition in creation of rpmdb temporary directory. The "rpmdb-more-verbose-error-logging" patch is still left in place, just for the case. [YOCTO #9416] (From OE-Core rev: 84de3283fa2a2908d367eb58953903ae685b0298) (From OE-Core rev: 1ae228ee5181f12955356c1fe10d341373dd5fcc) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/rpm/rpm/rpmdb-prevent-race-in-tmpdir-creation.patch')
-rw-r--r--meta/recipes-devtools/rpm/rpm/rpmdb-prevent-race-in-tmpdir-creation.patch41
1 files changed, 41 insertions, 0 deletions
diff --git a/meta/recipes-devtools/rpm/rpm/rpmdb-prevent-race-in-tmpdir-creation.patch b/meta/recipes-devtools/rpm/rpm/rpmdb-prevent-race-in-tmpdir-creation.patch
new file mode 100644
index 0000000000..f483f3ad90
--- /dev/null
+++ b/meta/recipes-devtools/rpm/rpm/rpmdb-prevent-race-in-tmpdir-creation.patch
@@ -0,0 +1,41 @@
1rpmdb: prevent race in tmpdir creation
2
3If two (or more) instances of rpm are running at the same time they may
4be trying to create the same (base-)temporary directory at the same time
5which causes the other mkdir to fail with EEXIST. This patch prevents a
6failure caused by this race by ignoring EEXIST error on directory
7creation.
8
9Upstream-Status: Pending
10
11Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
12
13diff --git a/rpmdb/signature.c b/rpmdb/signature.c
14index dce6c4e..100204b 100644
15--- a/rpmdb/signature.c
16+++ b/rpmdb/signature.c
17@@ -37,6 +37,7 @@ int rpmTempFile(const char * prefix, const char ** fnptr, void * fdptr)
18 int temput;
19 FD_t fd = NULL;
20 unsigned int ran;
21+ int ret = 0;
22
23 if (!prefix) prefix = "";
24
25@@ -44,8 +45,11 @@ int rpmTempFile(const char * prefix, const char ** fnptr, void * fdptr)
26 if (!_initialized) {
27 _initialized = 1;
28 tempfn = rpmGenPath(prefix, tpmacro, NULL);
29- if (rpmioMkpath(tempfn, 0755, (uid_t) -1, (gid_t) -1))
30- goto errxit;
31+ ret = rpmioMkpath(tempfn, 0755, (uid_t) -1, (gid_t) -1);
32+ if (ret && ret != EEXIST) {
33+ rpmlog(RPMLOG_ERR, _("error creating temporary directory %s: %d\n"), tempfn, ret);
34+ goto errxit;
35+ }
36 }
37
38 /* XXX should probably use mkstemp here */
39--
402.6.6
41