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

View file

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