/* ISC license. */ #include #include #include #include #include #include #ifdef SKALIBS_HASOCLOEXEC int open2 (char const *s, unsigned int flags) { int r ; do r = open(s, flags) ; while (r == -1 && errno == EINTR) ; return r ; } #else int open2 (char const *s, unsigned int flags) { int fd ; do fd = open(s, flags & ~O_CLOEXEC) ; while (fd == -1 && errno == EINTR) ; if (fd == -1) return -1 ; if (flags & O_CLOEXEC && coe(fd) == -1) { fd_close(fd) ; return -1 ; } return fd ; } #endif