X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fnginx.c;h=8cb762859b9a1f2bdafb521250c1d0b3fff0c664;hb=bc7992ed0693313a2b1fe282a5bf23f1cc9f8e42;hp=283e8f6f3fa85ae2568aab63c45a170ed8ba35ca;hpb=3f2f61c7d74d9204405a4b0c21390451c98665a7;p=collectd.git diff --git a/src/nginx.c b/src/nginx.c index 283e8f6f..8cb76285 100644 --- a/src/nginx.c +++ b/src/nginx.c @@ -122,7 +122,8 @@ static int init (void) if (user != NULL) { - if (snprintf (credentials, 1024, "%s:%s", user, pass == NULL ? "" : pass) >= 1024) + if (ssnprintf (credentials, sizeof (credentials), + "%s:%s", user, pass == NULL ? "" : pass) >= sizeof (credentials)) { ERROR ("nginx plugin: Credentials would have been truncated."); return (-1); @@ -176,18 +177,15 @@ static void submit (char *type, char *inst, long long value) vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "nginx", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance)); + sstrncpy (vl.type, type, sizeof (vl.type)); if (inst != NULL) - { - strncpy (vl.type_instance, inst, sizeof (vl.type_instance)); - vl.type_instance[sizeof (vl.type_instance) - 1] = '\0'; - } + sstrncpy (vl.type_instance, inst, sizeof (vl.type_instance)); - plugin_dispatch_values (type, &vl); + plugin_dispatch_values (&vl); } /* void submit */ static int nginx_read (void)