mirror of
https://github.com/NixOS/nix.git
synced 2025-11-21 09:49:36 +01:00
Merge pull request #14110 from Mic92/ptsname
Fix thread-safety issue with ptsname() usage
This commit is contained in:
commit
b6f4788a8f
3 changed files with 39 additions and 3 deletions
|
|
@ -18,6 +18,7 @@
|
|||
#include "nix/store/user-lock.hh"
|
||||
#include "nix/store/globals.hh"
|
||||
#include "nix/store/build/derivation-env-desugar.hh"
|
||||
#include "nix/util/terminal.hh"
|
||||
|
||||
#include <queue>
|
||||
|
||||
|
|
@ -808,8 +809,7 @@ std::optional<Descriptor> DerivationBuilderImpl::startBuild()
|
|||
if (!builderOut)
|
||||
throw SysError("opening pseudoterminal master");
|
||||
|
||||
// FIXME: not thread-safe, use ptsname_r
|
||||
std::string slaveName = ptsname(builderOut.get());
|
||||
std::string slaveName = getPtsName(builderOut.get());
|
||||
|
||||
if (buildUser) {
|
||||
if (chmod(slaveName.c_str(), 0600))
|
||||
|
|
@ -923,7 +923,7 @@ void DerivationBuilderImpl::prepareSandbox()
|
|||
|
||||
void DerivationBuilderImpl::openSlave()
|
||||
{
|
||||
std::string slaveName = ptsname(builderOut.get());
|
||||
std::string slaveName = getPtsName(builderOut.get());
|
||||
|
||||
AutoCloseFD builderOut = open(slaveName.c_str(), O_RDWR | O_NOCTTY);
|
||||
if (!builderOut)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue