Skip to content
Snippets Groups Projects
  • Rebecca Turner's avatar
    1ea9158c
    glnx-fdio: try $TMPDIR if /var/tmp doesn't exist · 1ea9158c
    Rebecca Turner authored
    `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/
    1ea9158c
    History
    glnx-fdio: try $TMPDIR if /var/tmp doesn't exist
    Rebecca Turner authored
    `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/