Skip to content
  • Dave Reisner's avatar
    do not check error from close(2) · eb19d41d
    Dave Reisner authored and Allan McRae's avatar Allan McRae committed
    
    
    On operating systems we support, the behavior is always such that the
    kernel will do the right thing as far as invalidating the file
    descriptor, regardless of the eventual return value. Therefore,
    potentially looping and calling close multiple times is wrong.
    
    At best, we call close again on an invalid FD and throw a spurious EBADF
    error. At worst, we might close an FD which doesn't belong to us when a
    multi-threaded application opens its own file descriptor between
    iterations of the loop.
    
    Signed-off-by: default avatarDave Reisner <dreisner@archlinux.org>
    Signed-off-by: default avatarAllan McRae <allan@archlinux.org>
    eb19d41d