Skip to content

Commit

Permalink
On macOS, don't use /var/folders for TMPDIR
Browse files Browse the repository at this point in the history
This broke "nix-store --serve".
  • Loading branch information
edolstra committed Jun 12, 2017
1 parent 847f19a commit 25230a1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/libmain/shared.cc
Expand Up @@ -138,6 +138,14 @@ void initNix()
struct timeval tv;
gettimeofday(&tv, 0);
srandom(tv.tv_usec);

/* On macOS, don't use the per-session TMPDIR (as set e.g. by
sshd). This breaks build users because they don't have access
to the TMPDIR, in particular in ‘nix-store --serve’. */
#if __APPLE__
if (getuid() == 0 && hasPrefix(getEnv("TMPDIR"), "/var/folders/"))
unsetenv("TMPDIR");
#endif
}


Expand Down

0 comments on commit 25230a1

Please sign in to comment.