From 6962ee368906e096cf2df3031ca5142117e7c52a Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Fri, 14 Oct 2016 13:41:26 +0300 Subject: 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 Signed-off-by: Ross Burton Signed-off-by: Richard Purdie Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- ...more-verbose-error-logging-in-rpmTempFile.patch | 26 ++-------------------- 1 file changed, 2 insertions(+), 24 deletions(-) (limited to 'meta/recipes-devtools/rpm/rpm/rpmdb-more-verbose-error-logging-in-rpmTempFile.patch') diff --git a/meta/recipes-devtools/rpm/rpm/rpmdb-more-verbose-error-logging-in-rpmTempFile.patch b/meta/recipes-devtools/rpm/rpm/rpmdb-more-verbose-error-logging-in-rpmTempFile.patch index 809e54e9cb..3a6f8746cc 100644 --- a/meta/recipes-devtools/rpm/rpm/rpmdb-more-verbose-error-logging-in-rpmTempFile.patch +++ b/meta/recipes-devtools/rpm/rpm/rpmdb-more-verbose-error-logging-in-rpmTempFile.patch @@ -5,32 +5,10 @@ Upstream-Status: Inappropriate [debugging] Signed-off-by: Markus Lehtonen diff --git a/rpmdb/signature.c b/rpmdb/signature.c -index dce6c4e..a1d0f06 100644 +index 100204b..e56ab3d 100644 --- a/rpmdb/signature.c +++ b/rpmdb/signature.c -@@ -37,6 +37,7 @@ int rpmTempFile(const char * prefix, const char ** fnptr, void * fdptr) - int temput; - FD_t fd = NULL; - unsigned int ran; -+ int ret = 0; - - if (!prefix) prefix = ""; - -@@ -44,8 +45,11 @@ int rpmTempFile(const char * prefix, const char ** fnptr, void * fdptr) - if (!_initialized) { - _initialized = 1; - tempfn = rpmGenPath(prefix, tpmacro, NULL); -- if (rpmioMkpath(tempfn, 0755, (uid_t) -1, (gid_t) -1)) -- goto errxit; -+ ret = rpmioMkpath(tempfn, 0755, (uid_t) -1, (gid_t) -1); -+ if (ret) { -+ rpmlog(RPMLOG_ERR, _("error creating temporary directory %s: %d\n"), tempfn, ret); -+ goto errxit; -+ } - } - - /* XXX should probably use mkstemp here */ -@@ -68,12 +72,16 @@ int rpmTempFile(const char * prefix, const char ** fnptr, void * fdptr) +@@ -72,12 +72,16 @@ int rpmTempFile(const char * prefix, const char ** fnptr, void * fdptr) #endif temput = urlPath(tempfn, &tfn); -- cgit v1.2.3-54-g00ecf