Skip to content

Commit

Permalink
fix: Treat empty XDG_RUNTIME_DIR as unset
Browse files Browse the repository at this point in the history
See preceding commit. Not observed in the wild, but is sensible
and consistent with TMPDIR behavior.
  • Loading branch information
roberth committed Mar 23, 2024
1 parent c3fb2aa commit b9e7f5a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/nix-build/nix-build.cc
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,9 @@ static void main_nix_build(int argc, char * * argv)
// Set the environment.
auto env = getEnv();

auto tmp = getEnv("TMPDIR");
if (!tmp || tmp->empty()) tmp = getEnv("XDG_RUNTIME_DIR").value_or("/tmp");
auto tmp = getEnvNonEmpty("TMPDIR");
if (!tmp)
tmp = getEnvNonEmpty("XDG_RUNTIME_DIR").value_or("/tmp");

if (pure) {
decltype(env) newEnv;
Expand Down

0 comments on commit b9e7f5a

Please sign in to comment.