summary refs log tree commit diff
path: root/nix/libstore/local-store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-01-12 17:27:40 +0100
committerLudovic Courtès <ludo@gnu.org>2016-05-31 14:25:28 +0200
commit56b8f56788b082fc54dedbb003b2891294dd6c22 (patch)
tree6ba5ec17c3f28d4b342f8ec11c815527c27ae4c0 /nix/libstore/local-store.cc
parent7f3b2510d6b050b8fb0974fa0cd7a164ac51f6d1 (diff)
downloadguix-56b8f56788b082fc54dedbb003b2891294dd6c22.tar.gz
daemon: Canonicalize gids to 0.
Previously files in the Nix store were owned by root or by nixbld,
depending on whether they were created by a substituter or by a
builder. This doesn't matter much, but causes spurious diffoscope
differences. So use root everywhere.
Diffstat (limited to 'nix/libstore/local-store.cc')
-rw-r--r--nix/libstore/local-store.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/nix/libstore/local-store.cc b/nix/libstore/local-store.cc
index 11f61ae030..1eed0ca77f 100644
--- a/nix/libstore/local-store.cc
+++ b/nix/libstore/local-store.cc
@@ -606,10 +606,10 @@ static void canonicalisePathMetaData_(const Path & path, uid_t fromUid, InodesSe
        users group); we check for this case below. */
     if (st.st_uid != geteuid()) {
 #if HAVE_LCHOWN
-        if (lchown(path.c_str(), geteuid(), (gid_t) -1) == -1)
+        if (lchown(path.c_str(), geteuid(), getegid()) == -1)
 #else
         if (!S_ISLNK(st.st_mode) &&
-            chown(path.c_str(), geteuid(), (gid_t) -1) == -1)
+            chown(path.c_str(), geteuid(), getegid()) == -1)
 #endif
             throw SysError(format("changing owner of `%1%' to %2%")
                 % path % geteuid());