Module: check_mk
Branch: master
Commit: 0b42a4d975d3b603c84c2b2c78dd422529fbcfb8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0b42a4d975d3b6…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Mar 31 06:23:00 2015 +0200
Make a simpler fix for the g_pnp_path issue
---
livestatus/src/module.c | 8 +++++---
livestatus/src/pnp4nagios.cc | 2 +-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/livestatus/src/module.c b/livestatus/src/module.c
index 7115cd8..71188c5 100644
--- a/livestatus/src/module.c
+++ b/livestatus/src/module.c
@@ -97,7 +97,8 @@ void *g_nagios_handle;
int g_unix_socket = -1;
int g_max_fd_ever = 0;
char g_socket_path[4096];
-char g_pnp_path[4096]; // base path for PNP4Nagios graphs
+char pnp_path_storage[4096];
+char *g_pnp_path = pnp_path_storage;
char g_mk_inventory_path[4096]; // base path of Check_MK inventor files
char g_logfile_path[4096];
int g_debug_level = 0;
@@ -731,9 +732,10 @@ void livestatus_parse_arguments(const char *args_orig)
}
}
else if (!strcmp(left, "pnp_path")) {
- strncpy(g_pnp_path, right, sizeof(g_pnp_path) - 1);
+ strncpy(g_pnp_path, right, sizeof(pnp_path_storage) - 1);
+ // make sure, that trailing slash is always there
if (right[strlen(right) - 1] != '/')
- strncat(g_pnp_path, "/", sizeof(g_pnp_path) -
strlen(g_pnp_path) - 1 ); // make sure, that trailing slash is always there
+ strncat(g_pnp_path, "/", sizeof(pnp_path_storage) -
strlen(g_pnp_path) - 1 );
check_path("PNP perfdata directory", g_pnp_path);
}
else if (!strcmp(left, "mk_inventory_path")) {
diff --git a/livestatus/src/pnp4nagios.cc b/livestatus/src/pnp4nagios.cc
index e001c06..fee674f 100644
--- a/livestatus/src/pnp4nagios.cc
+++ b/livestatus/src/pnp4nagios.cc
@@ -32,7 +32,7 @@
#include "pnp4nagios.h"
-extern char g_pnp_path[];
+extern char *g_pnp_path;
char *cleanup_pnpname(char *name)
{