[![Build Status](https://travis-ci.org/firehol/netdata.svg?branch=master)](https://travis-ci.org/firehol/netdata)
-[![User Base](https://registry.my-netdata.io/api/v1/badge.svg?chart=netdata.registry_entries&dimensions=persons&label=user%20base&units=null&value_color=blue&precision=0&v40)](https://registry.my-netdata.io/#netdata_registry)
-[![Monitored Servers](https://registry.my-netdata.io/api/v1/badge.svg?chart=netdata.registry_entries&dimensions=machines&label=servers%20monitored&units=null&value_color=orange&precision=0&v40)](https://registry.my-netdata.io/#netdata_registry)
-[![Sessions Served](https://registry.my-netdata.io/api/v1/badge.svg?chart=netdata.registry_sessions&label=sessions%20served&units=null&value_color=yellowgreen&precision=0&v40)](https://registry.my-netdata.io/#netdata_registry)
-
-[![New Users Today](http://registry.my-netdata.io/api/v1/badge.svg?chart=netdata.registry_entries&dimensions=persons&after=-86400&options=unaligned&group=incremental-sum&label=new%20users%20today&units=null&value_color=blue&precision=0&v40)](https://registry.my-netdata.io/#netdata_registry)
-[![New Machines Today](https://registry.my-netdata.io/api/v1/badge.svg?chart=netdata.registry_entries&dimensions=machines&group=incremental-sum&after=-86400&options=unaligned&label=servers%20added%20today&units=null&value_color=orange&precision=0&v40)](https://registry.my-netdata.io/#netdata_registry)
-[![Sessions Today](https://registry.my-netdata.io/api/v1/badge.svg?chart=netdata.registry_sessions&after=-86400&group=incremental-sum&options=unaligned&label=sessions%20served%20today&units=null&value_color=yellowgreen&precision=0&v40)](https://registry.my-netdata.io/#netdata_registry)
+<a href="https://scan.coverity.com/projects/firehol-netdata"><img alt="Coverity Scan Build Status" src="https://scan.coverity.com/projects/9140/badge.svg"/></a>
+[![User Base](https://registry.my-netdata.io/api/v1/badge.svg?chart=netdata.registry_entries&dimensions=persons&label=user%20base&units=null&value_color=blue&precision=0&v41)](https://registry.my-netdata.io/#netdata_registry)
+[![Monitored Servers](https://registry.my-netdata.io/api/v1/badge.svg?chart=netdata.registry_entries&dimensions=machines&label=servers%20monitored&units=null&value_color=orange&precision=0&v41)](https://registry.my-netdata.io/#netdata_registry)
+[![Sessions Served](https://registry.my-netdata.io/api/v1/badge.svg?chart=netdata.registry_sessions&label=sessions%20served&units=null&value_color=yellowgreen&precision=0&v41)](https://registry.my-netdata.io/#netdata_registry)
+
+[![New Users Today](http://registry.my-netdata.io/api/v1/badge.svg?chart=netdata.registry_entries&dimensions=persons&after=-86400&options=unaligned&group=incremental-sum&label=new%20users%20today&units=null&value_color=blue&precision=0&v41)](https://registry.my-netdata.io/#netdata_registry)
+[![New Machines Today](https://registry.my-netdata.io/api/v1/badge.svg?chart=netdata.registry_entries&dimensions=machines&group=incremental-sum&after=-86400&options=unaligned&label=servers%20added%20today&units=null&value_color=orange&precision=0&v41)](https://registry.my-netdata.io/#netdata_registry)
+[![Sessions Today](https://registry.my-netdata.io/api/v1/badge.svg?chart=netdata.registry_sessions&after=-86400&group=incremental-sum&options=unaligned&label=sessions%20served%20today&units=null&value_color=yellowgreen&precision=0&v41)](https://registry.my-netdata.io/#netdata_registry)
# netdata
va_list args;
va_start(args, fmt);
- return vsnprintfz(dst, n, fmt, args);
+ int ret = vsnprintfz(dst, n, fmt, args);
va_end(args);
+
+ return ret;
}
}
if(user && *user) {
- if(become_user(user, (*access_fd)?*access_fd:-1, output_fd, error_fd, pidfd) != 0) {
+ if(become_user(user, (access_fd)?*access_fd:-1, output_fd, error_fd, pidfd) != 0) {
error("Cannot become user '%s'. Continuing as we are.", user);
}
else info("Successfully became user '%s'.", user);
else {
debug(D_REGISTRY, "Dictionary: cloning value to '%s'", name);
- void *value = malloc(value_len),
+ // copy the new value without breaking
+ // any other thread accessing the same entry
+ void *new = malloc(value_len),
*old = nv->value;
- if(unlikely(!nv->value))
+ if(unlikely(!new))
fatal("Cannot allocate value of size %zu", value_len);
- memcpy(value, value, value_len);
- nv->value = value;
+ memcpy(new, value, value_len);
+ nv->value = new;
debug(D_REGISTRY, "Dictionary: freeing old value of '%s'", name);
free(old);
total += ret;
if(a->left) {
- dictionary_walker(a->left, callback, data);
+ ret = dictionary_walker(a->left, callback, data);
if (ret < 0) return ret;
total += ret;
}
while(likely(s < e)) {
// we are not at the end
- switch(ff->separators[(int)(*s)]) {
+ switch(ff->separators[(uint8_t)(*s)]) {
case PF_CHAR_IS_OPEN:
if(s == t) {
opened++;
break;
}
}
+
+ fclose(fp);
}
// open the log again
void rrdr_json_wrapper_end(RRDR *r, BUFFER *wb, uint32_t format, uint32_t options, int string_value)
{
- if(r) {;}
- if(format) {;}
+ (void)format;
char kq[2] = "", // key quote
sq[2] = ""; // string quote
debug(D_WEB_BUFFER, "Freeing web buffer of size %zu.", b->size);
- if(b->buffer) free(b->buffer);
+ free(b->buffer);
free(b);
}
case AF_INET6:
if(strncmp(w->client_ip, "::ffff:", 7) == 0) {
- strcpy(w->client_ip, &w->client_ip[7]);
+ memmove(w->client_ip, &w->client_ip[7], strlen(&w->client_ip[7]) + 1);
debug(D_WEB_CLIENT_ACCESS, "%llu: New IPv4 web client from %s port %s on socket %d.", w->id, w->client_ip, w->client_port, w->ifd);
}
else
int points = (points_str && *points_str )?atoi(points_str):1;
int precision = (precision_str && *precision_str)?atoi(precision_str):-1;
+ if(!multiply) multiply = 1;
+ if(!divide) divide = 1;
+
int refresh = 0;
if(refresh_str && *refresh_str) {
if(!strcmp(refresh_str, "auto")) {
// get the name of the data to show
char *tok = mystrsep(&url, "/");
+ if(!tok) tok = "";
// do we have such a data set?
- if(tok && *tok) {
+ if(*tok) {
debug(D_WEB_CLIENT, "%llu: Searching for RRD data with name '%s'.", w->id, tok);
st = rrdset_find_byname(tok);
if(!st) st = rrdset_find(tok);
}
/* avoid "address already in use" */
- setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*)&sockopt, sizeof(sockopt));
+ if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*)&sockopt, sizeof(sockopt)) != 0)
+ error("Cannot set SO_REUSEADDR on port's %d socket.", port);
struct sockaddr_in name;
memset(&name, 0, sizeof(struct sockaddr_in));
}
/* avoid "address already in use" */
- setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*)&sockopt, sizeof(sockopt));
+ if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*)&sockopt, sizeof(sockopt)) != 0)
+ error("Cannot set SO_REUSEADDR on port's %d socket.", port);
struct sockaddr_in6 name;
memset(&name, 0, sizeof(struct sockaddr_in6));