Remove a variable in LocalDerivationGoal

This commit is contained in:
Eelco Dolstra 2023-03-15 10:41:38 +01:00
parent 6029c763c2
commit 5eb8bfd0f1
2 changed files with 5 additions and 9 deletions

View file

@ -808,7 +808,7 @@ void LocalDerivationGoal::startBuilder()
throw SysError("opening pseudoterminal master");
// FIXME: not thread-safe, use ptsname_r
slaveName = ptsname(builderOut.get());
std::string slaveName = ptsname(builderOut.get());
if (buildUser) {
if (chmod(slaveName.c_str(), 0600))
@ -898,7 +898,7 @@ void LocalDerivationGoal::startBuilder()
if (usingUserNamespace)
options.cloneFlags |= CLONE_NEWUSER;
pid_t child = startProcess([&]() { runChild(); }, options);
pid_t child = startProcess([&]() { runChild(slaveName); }, options);
writeFull(sendPid.writeSide.get(), fmt("%d\n", child));
_exit(0);
@ -974,7 +974,7 @@ void LocalDerivationGoal::startBuilder()
#endif
{
pid = startProcess([&]() {
runChild();
runChild(slaveName);
});
}
@ -1620,7 +1620,7 @@ void setupSeccomp()
}
void LocalDerivationGoal::runChild()
void LocalDerivationGoal::runChild(const Path & slaveName)
{
/* Warning: in the child we should absolutely not make any SQLite
calls! */

View file

@ -28,10 +28,6 @@ struct LocalDerivationGoal : public DerivationGoal
standard output/error. */
AutoCloseFD builderOut;
/* Slave side of the pseudoterminal used for the builder's
standard output/error. */
Path slaveName;
/* Pipe for synchronising updates to the builder namespaces. */
Pipe userNamespaceSync;
@ -173,7 +169,7 @@ struct LocalDerivationGoal : public DerivationGoal
int getChildStatus() override;
/* Run the builder's process. */
void runChild();
void runChild(const std::string & slaveName);
/* Check that the derivation outputs all exist and register them
as valid. */