commit fdaa405883278c038c582ccb616a74e819bb4b72
parent 7e68c0424e4bb78c4b3bfbc8287e66be3a456b61
Author: Naveen Narayanan <zerous@nocebo.space>
Date: Sat, 25 Sep 2021 16:48:55 +0200
Initialize instead of using memset
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/finger.c b/finger.c
@@ -48,7 +48,8 @@ cred(char *username, char *hostname, char *input)
int
main(int argc, char **argv)
{
- struct addrinfo hints, *res, *p;
+ struct addrinfo hints = { 0 };
+ struct addrinfo *res, *p;
char user[32], hostname[MAXHOSTNAMELEN+1];
char *msg;
int status, sockfd, byt, len, err;
@@ -61,7 +62,6 @@ main(int argc, char **argv)
if (!cred(user, hostname, argv[1]))
usage();
- memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;