diff options
Diffstat (limited to 'src/arm/test_gnunet_service_arm.c')
-rw-r--r-- | src/arm/test_gnunet_service_arm.c | 51 |
1 files changed, 46 insertions, 5 deletions
diff --git a/src/arm/test_gnunet_service_arm.c b/src/arm/test_gnunet_service_arm.c index 3e4b9db49..199ea6d85 100644 --- a/src/arm/test_gnunet_service_arm.c +++ b/src/arm/test_gnunet_service_arm.c | |||
@@ -214,13 +214,54 @@ main (int argc, char *av[]) | |||
214 | strcpy (hostname, | 214 | strcpy (hostname, |
215 | "www.gnu.org"); | 215 | "www.gnu.org"); |
216 | } | 216 | } |
217 | if (NULL == gethostbyname (hostname)) | 217 | /* trigger DNS lookup */ |
218 | #if HAVE_GETADDRINFO | ||
218 | { | 219 | { |
219 | FPRINTF (stderr, | 220 | struct addrinfo *ai; |
220 | "Failed to resolve my hostname `%s', testcase not run.\n", | 221 | int ret; |
221 | hostname); | 222 | |
222 | return 0; | 223 | if (0 != (ret = getaddrinfo (hostname, NULL, NULL, &ai))) |
224 | { | ||
225 | FPRINTF (stderr, | ||
226 | "Failed to resolve my hostname `%s', testcase not run.\n", | ||
227 | hostname); | ||
228 | return 0; | ||
229 | } | ||
230 | freeaddrinfo (ai); | ||
231 | } | ||
232 | #elif HAVE_GETHOSTBYNAME2 | ||
233 | { | ||
234 | struct hostent *host; | ||
235 | |||
236 | host = gethostbyname2 (hostname, AF_INET); | ||
237 | if (NULL == host) | ||
238 | host = gethostbyname2 (hostname, AF_INET6); | ||
239 | if (NULL == host) | ||
240 | { | ||
241 | FPRINTF (stderr, | ||
242 | "Failed to resolve my hostname `%s', testcase not run.\n", | ||
243 | hostname); | ||
244 | return 0; | ||
245 | } | ||
246 | } | ||
247 | #elif HAVE_GETHOSTBYNAME | ||
248 | { | ||
249 | struct hostent *host; | ||
250 | |||
251 | host = gethostbyname (hostname); | ||
252 | if (NULL == host) | ||
253 | { | ||
254 | FPRINTF (stderr, | ||
255 | "Failed to resolve my hostname `%s', testcase not run.\n", | ||
256 | hostname); | ||
257 | return 0; | ||
258 | } | ||
223 | } | 259 | } |
260 | #else | ||
261 | FPRINTF (stderr, | ||
262 | "libc fails to have resolver function, testcase not run.\n"); | ||
263 | return 0; | ||
264 | #endif | ||
224 | GNUNET_log_setup ("test-gnunet-service-arm", | 265 | GNUNET_log_setup ("test-gnunet-service-arm", |
225 | "WARNING", | 266 | "WARNING", |
226 | NULL); | 267 | NULL); |