Merge branch 'collectd-4.8' into collectd-4.9
[collectd.git] / src / ping.c
index 5366b98..b536f42 100644 (file)
@@ -184,10 +184,11 @@ static void *ping_thread (void *arg) /* {{{ */
   count = 0;
   for (hl = hostlist_head; hl != NULL; hl = hl->next)
   {
-    int status;
-    status = ping_host_add (pingobj, hl->host);
-    if (status != 0)
-      WARNING ("ping plugin: ping_host_add (%s) failed.", hl->host);
+    int tmp_status;
+    tmp_status = ping_host_add (pingobj, hl->host);
+    if (tmp_status != 0)
+      WARNING ("ping plugin: ping_host_add (%s) failed: %s",
+          hl->host, ping_get_error (pingobj));
     else
       count++;
   }
@@ -217,7 +218,9 @@ static void *ping_thread (void *arg) /* {{{ */
 
     if (gettimeofday (&tv_begin, NULL) < 0)
     {
-      ERROR ("ping plugin: gettimeofday failed");
+      char errbuf[1024];
+      ERROR ("ping plugin: gettimeofday failed: %s",
+          sstrerror (errno, errbuf, sizeof (errbuf)));
       ping_thread_error = 1;
       break;
     }
@@ -322,7 +325,9 @@ static void *ping_thread (void *arg) /* {{{ */
 
     if (gettimeofday (&tv_end, NULL) < 0)
     {
-      ERROR ("ping plugin: gettimeofday failed");
+      char errbuf[1024];
+      ERROR ("ping plugin: gettimeofday failed: %s",
+          sstrerror (errno, errbuf, sizeof (errbuf)));
       ping_thread_error = 1;
       break;
     }