projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
turbostat: Fix parsing warnings
[collectd.git]
/
src
/
sysevent.c
diff --git
a/src/sysevent.c
b/src/sysevent.c
index
83924c8
..
7f9aa9f
100644
(file)
--- a/
src/sysevent.c
+++ b/
src/sysevent.c
@@
-26,10
+26,10
@@
#include "collectd.h"
#include "collectd.h"
-#include "common.h"
#include "plugin.h"
#include "plugin.h"
+#include "utils/common/common.h"
+#include "utils/ignorelist/ignorelist.h"
#include "utils_complain.h"
#include "utils_complain.h"
-#include "utils_ignorelist.h"
#include <errno.h>
#include <netdb.h>
#include <errno.h>
#include <netdb.h>
@@
-472,7
+472,7
@@
static int read_socket() {
} else {
DEBUG("sysevent plugin: writing %s", buffer);
} else {
DEBUG("sysevent plugin: writing %s", buffer);
- strncpy(ring.buffer[ring.head], buffer, sizeof(buffer));
+ s
s
trncpy(ring.buffer[ring.head], buffer, sizeof(buffer));
ring.timestamp[ring.head] = cdtime();
ring.head = next;
}
ring.timestamp[ring.head] = cdtime();
ring.head = next;
}
@@
-924,16
+924,26
@@
static int sysevent_init(void) /* {{{ */
ring.buffer = (char **)calloc(buffer_length, sizeof(char *));
if (ring.buffer == NULL) {
ring.buffer = (char **)calloc(buffer_length, sizeof(char *));
if (ring.buffer == NULL) {
- ERROR("sysevent plugin: sysevent_init calloc failed");
+ ERROR("sysevent plugin: sysevent_init
ring buffer
calloc failed");
return -1;
}
for (int i = 0; i < buffer_length; i++) {
ring.buffer[i] = calloc(1, listen_buffer_size);
return -1;
}
for (int i = 0; i < buffer_length; i++) {
ring.buffer[i] = calloc(1, listen_buffer_size);
+
+ if (ring.buffer[i] == NULL) {
+ ERROR("sysevent plugin: sysevent_init ring buffer entry calloc failed");
+ return -1;
+ }
}
ring.timestamp = (cdtime_t *)calloc(buffer_length, sizeof(cdtime_t));
}
ring.timestamp = (cdtime_t *)calloc(buffer_length, sizeof(cdtime_t));
+ if (ring.timestamp == NULL) {
+ ERROR("sysevent plugin: sysevent_init ring buffer timestamp calloc failed");
+ return -1;
+ }
+
if (sock == -1) {
struct addrinfo hints = {
.ai_family = AF_UNSPEC,
if (sock == -1) {
struct addrinfo hints = {
.ai_family = AF_UNSPEC,
@@
-1085,7
+1095,7
@@
static int sysevent_read(void) /* {{{ */
"Restarting it.",
sysevent_socket_thread_error);
"Restarting it.",
sysevent_socket_thread_error);
- stop_threads(
0
);
+ stop_threads();
start_threads();
start_threads();
@@
-1101,7
+1111,7
@@
static int sysevent_shutdown(void) /* {{{ */
{
DEBUG("sysevent plugin: Shutting down thread.");
{
DEBUG("sysevent plugin: Shutting down thread.");
- int status = stop_threads(
1
);
+ int status = stop_threads();
int status2 = 0;
if (sock != -1) {
int status2 = 0;
if (sock != -1) {