diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-07-21 14:45:24 +0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-07-21 14:45:24 +0200 |
commit | 1993b10d1169b04b83443a9ef5d4e3e38667afeb (patch) | |
tree | 29b197528040b8145577555ea3138a01df89fe36 /src | |
parent | 0a2bee307b20411f5b0dda0c662b1f9bb9e0e131 (diff) |
Fix Darwin build
Turns out getgrouplist() is not POSIX.
http://hydra.nixos.org/build/23881243
Diffstat (limited to 'src')
-rw-r--r-- | src/libstore/build.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc index 46d2841dc..e7696e44e 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -543,6 +543,7 @@ void UserLock::acquire() throw Error(format("the Nix user should not be a member of ‘%1%’") % settings.buildUsersGroup); +#if __linux__ /* Get the list of supplementary groups of this build user. This is usually either empty or contains a group such as "kvm". */ supplementaryGIDs.resize(10); @@ -553,6 +554,7 @@ void UserLock::acquire() throw Error(format("failed to get list of supplementary groups for ‘%1%’") % pw->pw_name); supplementaryGIDs.resize(ngroups); +#endif return; } @@ -2372,7 +2374,8 @@ void DerivationGoal::runChild() if (buildUser.enabled()) { /* Preserve supplementary groups of the build user, to allow admins to specify groups such as "kvm". */ - if (setgroups(buildUser.getSupplementaryGIDs().size(), + if (!buildUser.getSupplementaryGIDs().empty() && + setgroups(buildUser.getSupplementaryGIDs().size(), buildUser.getSupplementaryGIDs().data()) == -1) throw SysError("cannot set supplementary groups of build user"); |