Skip to content
Snippets Groups Projects
Commit 1ea9158c authored by Rebecca Turner's avatar Rebecca Turner
Browse files

glnx-fdio: try $TMPDIR if /var/tmp doesn't exist

`glnx_open_anonymous_tmpfile` attempts to create an fd in `/var/tmp`
regardless of the value of `$TMPDIR`.

This is _usually_ okay, but can fail in some contexts, such as in the
[NixOS][1] build environment, which doesn't have `/var` mapped at all.

To avoid failing in this case, if the inner call to
`glnx_open_anonymous_tmpfile_full` fails, we retrieve the value of
`$TMPDIR` and try calling `glnx_open_anonymous_tmpfile_full` again with
that directory instead.

In the fast path (i.e. where `/var/tmp` exists), functionality is
unchanged.

[1]: https://nixos.org/
parent 5ef78bb9
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment