Skip to content
Snippets Groups Projects
  • Colin Walters's avatar
    97cd6a6c
    Add glnx_fd_close() and glnx_autofd · 97cd6a6c
    Colin Walters authored
    I'd like to have the checks for `EBADF` as well as the
    "assign to -1" in more places.  The cleanup function we
    had for `glnx_fd_close` is actually what we want.
    
    Let's rename the cleanup macro to `glnx_autofd` to better match
    other autocleanups like `g_autofree`.
    
    Then we can use `glnx_fd_close()` as a replacement for plain Unix `close()`. I
    left the `glnx_close_fd` macro, but it's obviously confusing now with the
    former. We'll eventually remove it.
    97cd6a6c
    History
    Add glnx_fd_close() and glnx_autofd
    Colin Walters authored
    I'd like to have the checks for `EBADF` as well as the
    "assign to -1" in more places.  The cleanup function we
    had for `glnx_fd_close` is actually what we want.
    
    Let's rename the cleanup macro to `glnx_autofd` to better match
    other autocleanups like `g_autofree`.
    
    Then we can use `glnx_fd_close()` as a replacement for plain Unix `close()`. I
    left the `glnx_close_fd` macro, but it's obviously confusing now with the
    former. We'll eventually remove it.