Code

fix patch 998291
[nagiosplug.git] / plugins / check_ping.c
index e3f5398bc66ca99887f9d219bb31de6baef970bb..91764666da93e02f76daf4d3de2e729b7680fa29 100644 (file)
@@ -78,7 +78,7 @@ main (int argc, char **argv)
        addresses = malloc (sizeof(char*) * max_addr);
        addresses[0] = NULL;
 
-       if (process_arguments (argc, argv) != TRUE)
+       if (process_arguments (argc, argv) == ERROR)
                usage4 (_("Could not parse arguments"));
 
        /* Set signal handling and alarm */
@@ -469,13 +469,15 @@ error_scan (char buf[MAX_INPUT_BUFFER], const char *addr)
                die (STATE_CRITICAL, _("CRITICAL - Host Unreachable (%s)"), addr);
        else if (strstr (buf, "unknown host" ))
                die (STATE_CRITICAL, _("CRITICAL - Host not found (%s)"), addr);
+       else if (strstr (buf, "Time to live exceeded"))
+               die (STATE_CRITICAL, _("CRITICAL - Time to live exceeded (%s)"), addr);
 
        if (strstr (buf, "(DUP!)") || strstr (buf, "DUPLICATES FOUND")) {
                if (warn_text == NULL)
                        warn_text = strdup (_(WARN_DUPLICATES));
                else if (! strstr (warn_text, _(WARN_DUPLICATES)) &&
                         asprintf (&warn_text, "%s %s", warn_text, _(WARN_DUPLICATES)) == -1)
-                       die (STATE_UNKNOWN, _("unable to realloc warn_text"));
+                       die (STATE_UNKNOWN, _("Unable to realloc warn_text"));
                return (STATE_WARNING);
        }
 
@@ -484,17 +486,6 @@ error_scan (char buf[MAX_INPUT_BUFFER], const char *addr)
 
 
 
-void
-print_usage (void)
-{
-       printf (\
-"Usage: %s -H <host_address> -w <wrta>,<wpl>%% -c <crta>,<cpl>%%\n\
-  [-p packets] [-t timeout] [-L] [-4|-6]\n", progname);
-       printf (_(UT_HLP_VRS), progname, progname);
-}
-
-
-
 void
 print_help (void)
 {
@@ -539,3 +530,10 @@ the contrib area of the downloads section at http://www.nagios.org\n\n"));
 
        printf (_(UT_SUPPORT));
 }
+
+void
+print_usage (void)
+{
+       printf ("Usage: %s -H <host_address> -w <wrta>,<wpl>%% -c <crta>,<cpl>%%\n\
+                     [-p packets] [-t timeout] [-L] [-4|-6]\n", progname);
+}