Skip to content
Snippets Groups Projects
  • Colin Walters's avatar
    9929adcd
    fdio: Redo tmpfile API with GLnxTmpfile struct · 9929adcd
    Colin Walters authored
    The core problem with the previous tmpfile code
    is we don't have an autocleanup that calls `unlinkat`
    in the non-`O_TMPFILE` case.  And even if we did, it'd
    be awkward still since the `glnx_link_tmpfile_at()` call
    *consumes* the tmpfile.
    
    Fix this by introducing a struct with a cleanup macro. This simplifies a number
    of the callers in libostree - a notable case is where we had two arrays, one of
    fds, one of paths. It makes other places in libostree a bit more complex, but
    that's because some of the commit code paths want to deal with temporary
    *symlinks* too.
    
    Most callers are better though - in libglnx itself, `glnx_file_copy_at()` now
    correctly unlinks on failure for example.
    9929adcd
    History
    fdio: Redo tmpfile API with GLnxTmpfile struct
    Colin Walters authored
    The core problem with the previous tmpfile code
    is we don't have an autocleanup that calls `unlinkat`
    in the non-`O_TMPFILE` case.  And even if we did, it'd
    be awkward still since the `glnx_link_tmpfile_at()` call
    *consumes* the tmpfile.
    
    Fix this by introducing a struct with a cleanup macro. This simplifies a number
    of the callers in libostree - a notable case is where we had two arrays, one of
    fds, one of paths. It makes other places in libostree a bit more complex, but
    that's because some of the commit code paths want to deal with temporary
    *symlinks* too.
    
    Most callers are better though - in libglnx itself, `glnx_file_copy_at()` now
    correctly unlinks on failure for example.