freeaddrinfo(addrs);
return EAI_SYSTEM;
}
-
-// err points to where the error from netopen() should be stored
-PUBLIC_FN FILE *fnetopen(const char *node, const char *service, const struct addrinfo *hints, int *err) {
- int rval = netopen(node, service, hints);
- if (rval < 0) goto err;
-
- FILE *res = fdopen(rval, "r+");
- if (res) return res;
-
- int errno_ = errno;
- close(rval);
- errno = errno_;
- rval = EAI_SYSTEM;
-
-err:
- if (err) *err = rval;
- return NULL;
-}
\ No newline at end of file