compose: Stop calling fchdir in --unified-core mode

Changing the process' working directory is evil in potentially
multi-threaded code, and at this point we really should be using
`openat()`/fd-relative bits most everywhere.  But let's be
conservative and only stop doing it in `--unified-core` mode.

Closes: #1485
Approved by: jlebon
This commit is contained in:
Colin Walters 2018-08-01 14:45:07 -04:00 committed by Atomic Bot
parent 23badcd288
commit dcbd2d91ec

View File

@ -1025,9 +1025,16 @@ impl_install_tree (RpmOstreeTreeComposeContext *self,
g_printerr ("NOTICE: Proceeding anyways.\n"); g_printerr ("NOTICE: Proceeding anyways.\n");
} }
/* FIXME - is this still necessary? */ if (!opt_unified_core)
if (fchdir (self->workdir_dfd) != 0) {
return glnx_throw_errno_prefix (error, "fchdir"); /* This call is...old, dates back to when rpm-ostree wrapped
* running yum as a subprocess. It shouldn't be necessary
* any more, but let's be conservative and not do it in
* unified core mode.
*/
if (fchdir (self->workdir_dfd) != 0)
return glnx_throw_errno_prefix (error, "fchdir");
}
/* Set this early here, so we only have to set it one more time in the /* Set this early here, so we only have to set it one more time in the
* complete exit path too. * complete exit path too.