src/liboping.c: Use \#ifdef's around `EAI_SYSTEM'.
authorFlorian Forster <octo@verplant.org>
Wed, 30 Jan 2008 07:11:12 +0000 (08:11 +0100)
committerFlorian Forster <octo@verplant.org>
Wed, 30 Jan 2008 07:11:12 +0000 (08:11 +0100)
Apparently this define is mentioned in RFC3493 but not in SUS. At least Cygwin
seems not to have this define..

src/liboping.c

index 0371f15..22ab3a8 100644 (file)
@@ -941,9 +941,11 @@ int ping_setopt (pingobj_t *obj, int option, void *value)
                        if (status != 0)
                        {
                                ping_set_error (obj, "getaddrinfo",
-                                               status == EAI_SYSTEM
-                                               ? strerror (errno)
-                                               : gai_strerror (status));
+#if defined(EAI_SYSTEM)
+                                               (status == EAI_SYSTEM)
+                                               ? strerror (errno) :
+#endif
+                                               gai_strerror (status));
                                ret = -1;
                                break;
                        }
@@ -1073,9 +1075,11 @@ int ping_host_add (pingobj_t *obj, const char *host)
        {
                dprintf ("getaddrinfo failed\n");
                ping_set_error (obj, "getaddrinfo",
-                               (ai_return == EAI_SYSTEM)
-                               ? strerror (errno)
-                               : gai_strerror (ai_return));
+#if defined(EAI_SYSTEM)
+                                               (ai_return == EAI_SYSTEM)
+                                               ? strerror (errno) :
+#endif
+                               gai_strerror (ai_return));
                ping_free (ph);
                return (-1);
        }
@@ -1306,8 +1310,10 @@ int ping_iterator_get_info (pingobj_iter_t *iter, int info,
 #endif
                                   )
                                        ret = ENOMEM;
+#if defined(EAI_SYSTEM)
                                else if (ret == EAI_SYSTEM)
                                        ret = errno;
+#endif
                                else
                                        ret = EINVAL;
                        }