Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/net In the examples, initialize struct addrinfo exp...



details:   https://anonhg.NetBSD.org/src/rev/2b5e570683c5
branches:  trunk
changeset: 526796:2b5e570683c5
user:      kleink <kleink%NetBSD.org@localhost>
date:      Fri May 10 22:11:24 2002 +0000

description:
In the examples, initialize struct addrinfo explicitly to either 0 or a
NULL pointer; from der Mouse in PR lib/16634.

diffstat:

 lib/libc/net/getaddrinfo.3 |  15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diffs (41 lines):

diff -r 51560cbf5073 -r 2b5e570683c5 lib/libc/net/getaddrinfo.3
--- a/lib/libc/net/getaddrinfo.3        Fri May 10 22:02:11 2002 +0000
+++ b/lib/libc/net/getaddrinfo.3        Fri May 10 22:11:24 2002 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: getaddrinfo.3,v 1.24 2002/02/07 09:24:06 ross Exp $
+.\"    $NetBSD: getaddrinfo.3,v 1.25 2002/05/10 22:11:24 kleink Exp $
 .\"    $KAME: getaddrinfo.3,v 1.29 2001/02/12 09:24:45 itojun Exp $
 .\"
 .\" Copyright (c) 1983, 1987, 1991, 1993
@@ -421,9 +421,14 @@
 int s;
 const char *cause = NULL;
 
-memset(\*[Am]hints, 0, sizeof(hints));
 hints.ai_family = PF_UNSPEC;
 hints.ai_socktype = SOCK_STREAM;
+hints.ai_flags = 0;
+hints.ai_protocol = 0;
+hints.ai_addrlen = 0;
+hints.ai_canonname = NULL;
+hints.ai_addr = NULL;
+hints.ai_next = NULL;
 error = getaddrinfo("www.kame.net", "http", \*[Am]hints, \*[Am]res0);
 if (error) {
        errx(1, "%s", gai_strerror(error));
@@ -464,10 +469,14 @@
 int nsock;
 const char *cause = NULL;
 
-memset(\*[Am]hints, 0, sizeof(hints));
 hints.ai_family = PF_UNSPEC;
 hints.ai_socktype = SOCK_STREAM;
 hints.ai_flags = AI_PASSIVE;
+hints.ai_protocol = 0;
+hints.ai_addrlen = 0;
+hints.ai_canonname = NULL;
+hints.ai_addr = NULL;
+hints.ai_next = NULL;
 error = getaddrinfo(NULL, "http", \*[Am]hints, \*[Am]res0);
 if (error) {
        errx(1, "%s", gai_strerror(error));



Home | Main Index | Thread Index | Old Index