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
This commit is contained in:
Jonathan Lebon 2017-09-14 21:01:37 +00:00 committed by Atomic Bot
parent 80de17623f
commit e78807143f

View File

@ -405,14 +405,16 @@ rpmostree_context_ensure_tmpdir (RpmOstreeContext *self,
const char *subdir, const char *subdir,
GError **error) GError **error)
{ {
if (self->tmpdir.initialized) if (!self->tmpdir.initialized)
return TRUE; {
if (!glnx_mkdtemp ("rpmostree-core-XXXXXX", 0700, &self->tmpdir, error))
if (!glnx_mkdtemp ("rpmostree-core-XXXXXX", 0700,
&self->tmpdir, error))
return FALSE; return FALSE;
}
g_assert (self->tmpdir.initialized);
if (!glnx_shutil_mkdir_p_at (self->tmpdir.fd, subdir, 0755, NULL, error)) if (!glnx_shutil_mkdir_p_at (self->tmpdir.fd, subdir, 0755, NULL, error))
return FALSE; return FALSE;
return TRUE; return TRUE;
} }