From e78807143f35b716eb25daa63de3a768224b41b4 Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Thu, 14 Sep 2017 21:01:37 +0000 Subject: [PATCH] libpriv/core: fix tmpdir making logic Even if we're already initialized, we still need to create the subdir requested. This would cause relabeling to fail because we try to create the "relabel" subdir, which never actually gets created. Closes: #993 Approved by: cgwalters --- src/libpriv/rpmostree-core.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/libpriv/rpmostree-core.c b/src/libpriv/rpmostree-core.c index 1124f9ac..abc8cad7 100644 --- a/src/libpriv/rpmostree-core.c +++ b/src/libpriv/rpmostree-core.c @@ -405,14 +405,16 @@ rpmostree_context_ensure_tmpdir (RpmOstreeContext *self, const char *subdir, GError **error) { - if (self->tmpdir.initialized) - return TRUE; + if (!self->tmpdir.initialized) + { + if (!glnx_mkdtemp ("rpmostree-core-XXXXXX", 0700, &self->tmpdir, error)) + return FALSE; + } + g_assert (self->tmpdir.initialized); - if (!glnx_mkdtemp ("rpmostree-core-XXXXXX", 0700, - &self->tmpdir, error)) - return FALSE; if (!glnx_shutil_mkdir_p_at (self->tmpdir.fd, subdir, 0755, NULL, error)) return FALSE; + return TRUE; }