From c3a59abed85ab4ebd14ae470aedbdcf14d756452 Mon Sep 17 00:00:00 2001 From: Daniel Gerzo Date: Sun, 3 Aug 2008 09:50:20 +0000 Subject: [PATCH] - Include string.h to avoid compile warning about using bzero without defining it - use herror() rather than perror() to give useful error messages (the *hostby*() functions set h_errno not errno) PR: docs/126031 Submitted by: gavin --- .../books/developers-handbook/sockets/chapter.sgml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/en_US.ISO8859-1/books/developers-handbook/sockets/chapter.sgml b/en_US.ISO8859-1/books/developers-handbook/sockets/chapter.sgml index d4d4d6556d..04ba5320af 100644 --- a/en_US.ISO8859-1/books/developers-handbook/sockets/chapter.sgml +++ b/en_US.ISO8859-1/books/developers-handbook/sockets/chapter.sgml @@ -966,6 +966,7 @@ int connect(int s, const struct sockaddr *name, socklen_t namelen); * Programmed by G. Adam Stanislav */ #include <stdio.h> +#include <string.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> @@ -1181,6 +1182,7 @@ int accept(int s, struct sockaddr *addr, socklen_t *addrlen); * June 19, 2001 */ #include <stdio.h> +#include <string.h> #include <time.h> #include <unistd.h> #include <sys/types.h> @@ -1582,7 +1584,7 @@ int main(int argc, char *argv[]) { host = (argc > 1) ? (char *)argv[1] : "time.nist.gov"; if ((he = gethostbyname(host)) == NULL) { - perror(host); + herror(host); return 2; }