diff options
author | Manuel Novoa III <mjn3@codepoet.org> | 2003-03-19 09:13:01 +0000 |
---|---|---|
committer | Manuel Novoa III <mjn3@codepoet.org> | 2003-03-19 09:13:01 +0000 |
commit | cad5364599eb5062d59e0c397ed638ddd61a8d5d (patch) | |
tree | a318d0f03aa076c74b576ea45dc543a5669e8e91 /libbb/inet_common.c | |
parent | e01f9662a5bd5d91be4f6b3941b57fff73cd5af1 (diff) | |
download | busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.gz busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.bz2 busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.zip |
Major coreutils update.
Diffstat (limited to 'libbb/inet_common.c')
-rw-r--r-- | libbb/inet_common.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/libbb/inet_common.c b/libbb/inet_common.c index 16dd1db7c..5e2343bdd 100644 --- a/libbb/inet_common.c +++ b/libbb/inet_common.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * | 4 | * |
5 | * Heavily modified by Manuel Novoa III Mar 12, 2001 | 5 | * Heavily modified by Manuel Novoa III Mar 12, 2001 |
6 | * | 6 | * |
7 | * Version: $Id: inet_common.c,v 1.5 2002/11/28 09:52:23 bug1 Exp $ | 7 | * Version: $Id: inet_common.c,v 1.6 2003/03/19 09:12:07 mjn3 Exp $ |
8 | * | 8 | * |
9 | */ | 9 | */ |
10 | 10 | ||
@@ -44,7 +44,7 @@ int INET_resolve(const char *name, struct sockaddr_in *s_in, int hostfirst) | |||
44 | /* If we expect this to be a hostname, try hostname database first */ | 44 | /* If we expect this to be a hostname, try hostname database first */ |
45 | #ifdef DEBUG | 45 | #ifdef DEBUG |
46 | if (hostfirst) { | 46 | if (hostfirst) { |
47 | error_msg("gethostbyname (%s)", name); | 47 | bb_error_msg("gethostbyname (%s)", name); |
48 | } | 48 | } |
49 | #endif | 49 | #endif |
50 | if (hostfirst && (hp = gethostbyname(name)) != (struct hostent *) NULL) { | 50 | if (hostfirst && (hp = gethostbyname(name)) != (struct hostent *) NULL) { |
@@ -54,7 +54,7 @@ int INET_resolve(const char *name, struct sockaddr_in *s_in, int hostfirst) | |||
54 | } | 54 | } |
55 | /* Try the NETWORKS database to see if this is a known network. */ | 55 | /* Try the NETWORKS database to see if this is a known network. */ |
56 | #ifdef DEBUG | 56 | #ifdef DEBUG |
57 | error_msg("getnetbyname (%s)", name); | 57 | bb_error_msg("getnetbyname (%s)", name); |
58 | #endif | 58 | #endif |
59 | if ((np = getnetbyname(name)) != (struct netent *) NULL) { | 59 | if ((np = getnetbyname(name)) != (struct netent *) NULL) { |
60 | s_in->sin_addr.s_addr = htonl(np->n_net); | 60 | s_in->sin_addr.s_addr = htonl(np->n_net); |
@@ -71,7 +71,7 @@ int INET_resolve(const char *name, struct sockaddr_in *s_in, int hostfirst) | |||
71 | #endif | 71 | #endif |
72 | 72 | ||
73 | #ifdef DEBUG | 73 | #ifdef DEBUG |
74 | error_msg("gethostbyname (%s)", name); | 74 | bb_error_msg("gethostbyname (%s)", name); |
75 | #endif | 75 | #endif |
76 | if ((hp = gethostbyname(name)) == (struct hostent *) NULL) { | 76 | if ((hp = gethostbyname(name)) == (struct hostent *) NULL) { |
77 | errno = h_errno; | 77 | errno = h_errno; |
@@ -109,7 +109,7 @@ int INET_rresolve(char *name, size_t len, struct sockaddr_in *s_in, | |||
109 | /* Grmpf. -FvK */ | 109 | /* Grmpf. -FvK */ |
110 | if (s_in->sin_family != AF_INET) { | 110 | if (s_in->sin_family != AF_INET) { |
111 | #ifdef DEBUG | 111 | #ifdef DEBUG |
112 | error_msg("rresolve: unsupport address family %d !", | 112 | bb_error_msg("rresolve: unsupport address family %d !", |
113 | s_in->sin_family); | 113 | s_in->sin_family); |
114 | #endif | 114 | #endif |
115 | errno = EAFNOSUPPORT; | 115 | errno = EAFNOSUPPORT; |
@@ -117,7 +117,7 @@ int INET_rresolve(char *name, size_t len, struct sockaddr_in *s_in, | |||
117 | } | 117 | } |
118 | ad = (unsigned long) s_in->sin_addr.s_addr; | 118 | ad = (unsigned long) s_in->sin_addr.s_addr; |
119 | #ifdef DEBUG | 119 | #ifdef DEBUG |
120 | error_msg("rresolve: %08lx, mask %08x, num %08x", ad, netmask, numeric); | 120 | bb_error_msg("rresolve: %08lx, mask %08x, num %08x", ad, netmask, numeric); |
121 | #endif | 121 | #endif |
122 | if (ad == INADDR_ANY) { | 122 | if (ad == INADDR_ANY) { |
123 | if ((numeric & 0x0FFF) == 0) { | 123 | if ((numeric & 0x0FFF) == 0) { |
@@ -143,7 +143,7 @@ int INET_rresolve(char *name, size_t len, struct sockaddr_in *s_in, | |||
143 | if (pn->addr.sin_addr.s_addr == ad && pn->host == host) { | 143 | if (pn->addr.sin_addr.s_addr == ad && pn->host == host) { |
144 | safe_strncpy(name, pn->name, len); | 144 | safe_strncpy(name, pn->name, len); |
145 | #ifdef DEBUG | 145 | #ifdef DEBUG |
146 | error_msg("rresolve: found %s %08lx in cache", | 146 | bb_error_msg("rresolve: found %s %08lx in cache", |
147 | (host ? "host" : "net"), ad); | 147 | (host ? "host" : "net"), ad); |
148 | #endif | 148 | #endif |
149 | return (0); | 149 | return (0); |
@@ -156,7 +156,7 @@ int INET_rresolve(char *name, size_t len, struct sockaddr_in *s_in, | |||
156 | ent = NULL; | 156 | ent = NULL; |
157 | if (host) { | 157 | if (host) { |
158 | #ifdef DEBUG | 158 | #ifdef DEBUG |
159 | error_msg("gethostbyaddr (%08lx)", ad); | 159 | bb_error_msg("gethostbyaddr (%08lx)", ad); |
160 | #endif | 160 | #endif |
161 | ent = gethostbyaddr((char *) &ad, 4, AF_INET); | 161 | ent = gethostbyaddr((char *) &ad, 4, AF_INET); |
162 | if (ent != NULL) { | 162 | if (ent != NULL) { |
@@ -164,7 +164,7 @@ int INET_rresolve(char *name, size_t len, struct sockaddr_in *s_in, | |||
164 | } | 164 | } |
165 | } else { | 165 | } else { |
166 | #ifdef DEBUG | 166 | #ifdef DEBUG |
167 | error_msg("getnetbyaddr (%08lx)", host_ad); | 167 | bb_error_msg("getnetbyaddr (%08lx)", host_ad); |
168 | #endif | 168 | #endif |
169 | np = getnetbyaddr(host_ad, AF_INET); | 169 | np = getnetbyaddr(host_ad, AF_INET); |
170 | if (np != NULL) { | 170 | if (np != NULL) { |
@@ -178,7 +178,7 @@ int INET_rresolve(char *name, size_t len, struct sockaddr_in *s_in, | |||
178 | pn->addr = *s_in; | 178 | pn->addr = *s_in; |
179 | pn->next = INET_nn; | 179 | pn->next = INET_nn; |
180 | pn->host = host; | 180 | pn->host = host; |
181 | pn->name = xstrdup(name); | 181 | pn->name = bb_xstrdup(name); |
182 | INET_nn = pn; | 182 | INET_nn = pn; |
183 | 183 | ||
184 | return (0); | 184 | return (0); |
@@ -194,7 +194,7 @@ int INET6_resolve(char *name, struct sockaddr_in6 *sin6) | |||
194 | memset(&req, '\0', sizeof req); | 194 | memset(&req, '\0', sizeof req); |
195 | req.ai_family = AF_INET6; | 195 | req.ai_family = AF_INET6; |
196 | if ((s = getaddrinfo(name, NULL, &req, &ai))) { | 196 | if ((s = getaddrinfo(name, NULL, &req, &ai))) { |
197 | error_msg("getaddrinfo: %s: %d", name, s); | 197 | bb_error_msg("getaddrinfo: %s: %d", name, s); |
198 | return -1; | 198 | return -1; |
199 | } | 199 | } |
200 | memcpy(sin6, ai->ai_addr, sizeof(struct sockaddr_in6)); | 200 | memcpy(sin6, ai->ai_addr, sizeof(struct sockaddr_in6)); |
@@ -219,7 +219,7 @@ int INET6_rresolve(char *name, size_t len, struct sockaddr_in6 *sin6, | |||
219 | /* Grmpf. -FvK */ | 219 | /* Grmpf. -FvK */ |
220 | if (sin6->sin6_family != AF_INET6) { | 220 | if (sin6->sin6_family != AF_INET6) { |
221 | #ifdef DEBUG | 221 | #ifdef DEBUG |
222 | error_msg(_("rresolve: unsupport address family %d !\n"), | 222 | bb_error_msg(_("rresolve: unsupport address family %d !\n"), |
223 | sin6->sin6_family); | 223 | sin6->sin6_family); |
224 | #endif | 224 | #endif |
225 | errno = EAFNOSUPPORT; | 225 | errno = EAFNOSUPPORT; |
@@ -240,7 +240,7 @@ int INET6_rresolve(char *name, size_t len, struct sockaddr_in6 *sin6, | |||
240 | 240 | ||
241 | s = getnameinfo((struct sockaddr *) sin6, sizeof(struct sockaddr_in6), name, len, NULL, 0, 0); | 241 | s = getnameinfo((struct sockaddr *) sin6, sizeof(struct sockaddr_in6), name, len, NULL, 0, 0); |
242 | if (s) { | 242 | if (s) { |
243 | error_msg("getnameinfo failed"); | 243 | bb_error_msg("getnameinfo failed"); |
244 | return -1; | 244 | return -1; |
245 | } | 245 | } |
246 | return (0); | 246 | return (0); |