X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fstatsd.c;h=4a6c09a8a92d7ec643e9a69a9732a40e67272050;hp=5142613739e9c77f2542d64b352752af9ad7eb3c;hb=0b7cd83a5e6bac068ea83a88a5ddcfb07c09fbec;hpb=1b10ab706f8b70ce2f086e59a54cc09d671ad989 diff --git a/src/statsd.c b/src/statsd.c index 51426137..4a6c09a8 100644 --- a/src/statsd.c +++ b/src/statsd.c @@ -446,13 +446,11 @@ static void statsd_network_read(int fd) /* {{{ */ status = recv(fd, buffer, sizeof(buffer), /* flags = */ MSG_DONTWAIT); if (status < 0) { - char errbuf[1024]; if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) return; - ERROR("statsd plugin: recv(2) failed: %s", - sstrerror(errno, errbuf, sizeof(errbuf))); + ERROR("statsd plugin: recv(2) failed: %s", STRERRNO); return; } @@ -497,9 +495,7 @@ static int statsd_network_init(struct pollfd **ret_fds, /* {{{ */ fd = socket(ai_ptr->ai_family, ai_ptr->ai_socktype, ai_ptr->ai_protocol); if (fd < 0) { - char errbuf[1024]; - ERROR("statsd plugin: socket(2) failed: %s", - sstrerror(errno, errbuf, sizeof(errbuf))); + ERROR("statsd plugin: socket(2) failed: %s", STRERRNO); continue; } @@ -511,9 +507,7 @@ static int statsd_network_init(struct pollfd **ret_fds, /* {{{ */ status = bind(fd, ai_ptr->ai_addr, ai_ptr->ai_addrlen); if (status != 0) { - char errbuf[1024]; - ERROR("statsd plugin: bind(2) failed: %s", - sstrerror(errno, errbuf, sizeof(errbuf))); + ERROR("statsd plugin: bind(2) failed: %s", STRERRNO); close(fd); continue; } @@ -561,13 +555,11 @@ static void *statsd_network_thread(void *args) /* {{{ */ while (!network_thread_shutdown) { status = poll(fds, (nfds_t)fds_num, /* timeout = */ -1); if (status < 0) { - char errbuf[1024]; if ((errno == EINTR) || (errno == EAGAIN)) continue; - ERROR("statsd plugin: poll(2) failed: %s", - sstrerror(errno, errbuf, sizeof(errbuf))); + ERROR("statsd plugin: poll(2) failed: %s", STRERRNO); break; } @@ -605,9 +597,8 @@ static int statsd_config_timer_percentile(oconfig_item_t *ci) /* {{{ */ return ERANGE; } - tmp = - realloc(conf_timer_percentile, - sizeof(*conf_timer_percentile) * (conf_timer_percentile_num + 1)); + tmp = realloc(conf_timer_percentile, sizeof(*conf_timer_percentile) * + (conf_timer_percentile_num + 1)); if (tmp == NULL) { ERROR("statsd plugin: realloc failed."); return ENOMEM; @@ -669,10 +660,8 @@ static int statsd_init(void) /* {{{ */ /* attr = */ NULL, statsd_network_thread, /* args = */ NULL); if (status != 0) { - char errbuf[1024]; pthread_mutex_unlock(&metrics_lock); - ERROR("statsd plugin: pthread_create failed: %s", - sstrerror(errno, errbuf, sizeof(errbuf))); + ERROR("statsd plugin: pthread_create failed: %s", STRERRNO); return status; } }