Merge branch 'collectd-5.8'
[collectd.git] / src / notify_nagios.c
index bea0faa..68f6e2a 100644 (file)
@@ -67,10 +67,8 @@ static int nagios_print(char const *buffer) /* {{{ */
 
   fd = open(file, O_WRONLY | O_APPEND);
   if (fd < 0) {
-    char errbuf[1024];
     status = errno;
-    ERROR("notify_nagios plugin: Opening \"%s\" failed: %s", file,
-          sstrerror(status, errbuf, sizeof(errbuf)));
+    ERROR("notify_nagios plugin: Opening \"%s\" failed: %s", file, STRERRNO);
     return status;
   }
 
@@ -79,30 +77,26 @@ static int nagios_print(char const *buffer) /* {{{ */
 
   status = fcntl(fd, F_GETLK, &lock);
   if (status != 0) {
-    char errbuf[1024];
     status = errno;
     ERROR("notify_nagios plugin: Failed to acquire write lock on \"%s\": %s",
-          file, sstrerror(status, errbuf, sizeof(errbuf)));
+          file, STRERRNO);
     close(fd);
     return status;
   }
 
   status = (int)lseek(fd, 0, SEEK_END);
   if (status == -1) {
-    char errbuf[1024];
     status = errno;
     ERROR("notify_nagios plugin: Seeking to end of \"%s\" failed: %s", file,
-          sstrerror(status, errbuf, sizeof(errbuf)));
+          STRERRNO);
     close(fd);
     return status;
   }
 
   status = (int)swrite(fd, buffer, strlen(buffer));
   if (status != 0) {
-    char errbuf[1024];
     status = errno;
-    ERROR("notify_nagios plugin: Writing to \"%s\" failed: %s", file,
-          sstrerror(status, errbuf, sizeof(errbuf)));
+    ERROR("notify_nagios plugin: Writing to \"%s\" failed: %s", file, STRERRNO);
     close(fd);
     return status;
   }
@@ -142,9 +136,9 @@ static int nagios_notify(const notification_t *n, /* {{{ */
   }
 
   snprintf(buffer, sizeof(buffer),
-            "[%.0f] PROCESS_SERVICE_CHECK_RESULT;%s;%s;%d;%s\n",
-            CDTIME_T_TO_DOUBLE(n->time), n->host, &svc_description[1], code,
-            n->message);
+           "[%.0f] PROCESS_SERVICE_CHECK_RESULT;%s;%s;%d;%s\n",
+           CDTIME_T_TO_DOUBLE(n->time), n->host, &svc_description[1], code,
+           n->message);
 
   return nagios_print(buffer);
 } /* }}} int nagios_notify */