summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--collectors/ebpf_process.plugin/ebpf_process.c10
-rw-r--r--libnetdata/ebpf/ebpf.c9
2 files changed, 12 insertions, 7 deletions
diff --git a/collectors/ebpf_process.plugin/ebpf_process.c b/collectors/ebpf_process.plugin/ebpf_process.c
index 4a58a54dcc..8c7a34aa1a 100644
--- a/collectors/ebpf_process.plugin/ebpf_process.c
+++ b/collectors/ebpf_process.plugin/ebpf_process.c
@@ -170,11 +170,11 @@ static void int_exit(int sig)
dup2 (fd, STDIN_FILENO);
dup2 (fd, STDOUT_FILENO);
dup2 (fd, STDERR_FILENO);
-
- if (fd > 2)
- close (fd);
}
+ if (fd > 2)
+ close (fd);
+
int sid = setsid();
if(sid >= 0) {
sleep(1);
@@ -213,9 +213,9 @@ static inline void netdata_write_chart_cmd(char *type
, order);
}
-static void netdata_write_global_dimension(char *dimension, char *name)
+static void netdata_write_global_dimension(char *d, char *n)
{
- printf("DIMENSION %s %s absolute 1 1\n", dimension, name);
+ printf("DIMENSION %s %s absolute 1 1\n", d, n);
}
static void netdata_create_global_dimension(void *ptr, int end)
diff --git a/libnetdata/ebpf/ebpf.c b/libnetdata/ebpf/ebpf.c
index 5cd8b5fcf7..6c49706893 100644
--- a/libnetdata/ebpf/ebpf.c
+++ b/libnetdata/ebpf/ebpf.c
@@ -62,9 +62,11 @@ int get_kernel_version() {
if (fd < 0)
return -1;
- ssize_t len = read(fd, version, sizeof(version));
- if (len < 0)
+ ssize_t len = read(fd, ver, sizeof(ver));
+ if (len < 0) {
+ close(fd);
return -1;
+ }
close(fd);
@@ -79,6 +81,9 @@ int get_kernel_version() {
if (*version)
version++;
+ else
+ return -1;
+
move = patch;
while (*version) *move++ = *version++;
*move = '\0';