Initialize variables in netutl.c
This commit is contained in:
parent
e2245da720
commit
d803ac93dc
1 changed files with 8 additions and 3 deletions
11
src/netutl.c
11
src/netutl.c
|
@ -33,9 +33,11 @@ bool hostnames = false;
|
||||||
Return NULL on failure.
|
Return NULL on failure.
|
||||||
*/
|
*/
|
||||||
struct addrinfo *str2addrinfo(const char *address, const char *service, int socktype) {
|
struct addrinfo *str2addrinfo(const char *address, const char *service, int socktype) {
|
||||||
struct addrinfo *ai, hint = {0};
|
struct addrinfo *ai, hint;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
memset(&hint, 0x0, sizeof(struct addrinfo));
|
||||||
|
|
||||||
hint.ai_family = addressfamily;
|
hint.ai_family = addressfamily;
|
||||||
hint.ai_socktype = socktype;
|
hint.ai_socktype = socktype;
|
||||||
|
|
||||||
|
@ -53,10 +55,13 @@ struct addrinfo *str2addrinfo(const char *address, const char *service, int sock
|
||||||
}
|
}
|
||||||
|
|
||||||
sockaddr_t str2sockaddr(const char *address, const char *port) {
|
sockaddr_t str2sockaddr(const char *address, const char *port) {
|
||||||
struct addrinfo *ai, hint = {0};
|
struct addrinfo *ai, hint;
|
||||||
sockaddr_t result = {{0}};
|
sockaddr_t result;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
memset(&hint, 0x0, sizeof(struct addrinfo));
|
||||||
|
memset(&result, 0x0, sizeof(sockaddr_t));
|
||||||
|
|
||||||
hint.ai_family = AF_UNSPEC;
|
hint.ai_family = AF_UNSPEC;
|
||||||
hint.ai_flags = AI_NUMERICHOST;
|
hint.ai_flags = AI_NUMERICHOST;
|
||||||
hint.ai_socktype = SOCK_STREAM;
|
hint.ai_socktype = SOCK_STREAM;
|
||||||
|
|
Loading…
Reference in a new issue