forked from lix-project/lix
Fix macOS build
This commit is contained in:
parent
ba50c3efa3
commit
8c4cce553c
|
@ -1420,11 +1420,7 @@ void DerivationGoal::tryToBuild()
|
|||
|
||||
void DerivationGoal::tryLocalBuild() {
|
||||
|
||||
/* If `build-users-group' is not empty, then we have to build as
|
||||
one of the members of that group. */
|
||||
static bool useBuildUsers = (settings.buildUsersGroup != "" || settings.startId.get() != 0) && getuid() == 0;
|
||||
if (useBuildUsers) {
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
if (useBuildUsers()) {
|
||||
if (!buildUser)
|
||||
buildUser = acquireUserLock();
|
||||
|
||||
|
@ -1439,11 +1435,6 @@ void DerivationGoal::tryLocalBuild() {
|
|||
/* Make sure that no other processes are executing under this
|
||||
uid. */
|
||||
buildUser->kill();
|
||||
#else
|
||||
/* Don't know how to block the creation of setuid/setgid
|
||||
binaries on this platform. */
|
||||
throw Error("build users are not supported on this platform for security reasons");
|
||||
#endif
|
||||
}
|
||||
|
||||
actLock.reset();
|
||||
|
|
|
@ -209,4 +209,17 @@ std::unique_ptr<UserLock> acquireUserLock()
|
|||
return SimpleUserLock::acquire();
|
||||
}
|
||||
|
||||
bool useBuildUsers()
|
||||
{
|
||||
#if __linux__
|
||||
static bool b = (settings.buildUsersGroup != "" || settings.startId.get() != 0) && getuid() == 0;
|
||||
return b;
|
||||
#elif __APPLE__
|
||||
static bool b = settings.buildUsersGroup != "" && getuid() == 0;
|
||||
return b;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,4 +36,6 @@ struct UserLock
|
|||
is available. */
|
||||
std::unique_ptr<UserLock> acquireUserLock();
|
||||
|
||||
bool useBuildUsers();
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue