Skip to content
  • Thomas Haller's avatar
    core: add option to pass ownership of file descriptor to nm_utils_fd_get_contents() · de474233
    Thomas Haller authored and Beniamino Galvani's avatar Beniamino Galvani committed
    In many scenarios, we have no use for the file descriptor
    after nm_utils_fd_get_contents(). We just want to read it
    and close it.
    
    API wise, it would be nice that the get_contents() function never
    closes the passed in fd and it's always responsibility of the caller.
    
    However, that costs an additional dup() syscall that could
    be avoided, if we allow the function to (optionally) close
    the file descriptor.
    de474233