X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fnotify_nagios.c;h=b08c411df202741503e5339342da7d6397beffe1;hb=db961f476426f5dd3ca1663ffc094f0fc7f6f8a2;hp=1f4182bbf8efee2cdd125a7d9f742d8e6289eda3;hpb=17b60946497048b34b417aa0497607f3aa6a34f3;p=collectd.git diff --git a/src/notify_nagios.c b/src/notify_nagios.c index 1f4182bb..b08c411d 100644 --- a/src/notify_nagios.c +++ b/src/notify_nagios.c @@ -25,9 +25,9 @@ */ #include "collectd.h" + #include "plugin.h" #include "common.h" -#include "configfile.h" #define NAGIOS_OK 0 #define NAGIOS_WARNING 1 @@ -42,9 +42,7 @@ static char *nagios_command_file; static int nagios_config (oconfig_item_t *ci) /* {{{ */ { - int i; - - for (i = 0; i < ci->children_num; i++) + for (int i = 0; i < ci->children_num; i++) { oconfig_item_t *child = ci->children + i; @@ -63,7 +61,7 @@ static int nagios_print (char const *buffer) /* {{{ */ char const *file = NAGIOS_COMMAND_FILE; int fd; int status; - struct flock lock; + struct flock lock = { 0 }; if (nagios_command_file != NULL) file = nagios_command_file; @@ -78,11 +76,8 @@ static int nagios_print (char const *buffer) /* {{{ */ return status; } - memset (&lock, 0, sizeof (lock)); lock.l_type = F_WRLCK; lock.l_whence = SEEK_END; - lock.l_start = 0; - lock.l_len = 0; /* to end of file */ status = fcntl (fd, F_GETLK, &lock); if (status != 0)