/** Facilities for working with file descriptors. */ #include "config.h" // IWYU pragma: keep #include "fds.h" #include #include #include "wutil.h" void autoclose_fd_t::close() { if (fd_ < 0) return; exec_close(fd_); fd_ = -1; } void exec_close(int fd) { assert(fd >= 0 && "Invalid fd"); while (close(fd) == -1) { if (errno != EINTR) { wperror(L"close"); break; } } }