[icinga-checkins] icinga.org: icinga-core/mfriedrich/core: core: fix compiling with embedded perl #2197

git at icinga.org git at icinga.org
Tue Aug 21 17:36:12 CEST 2012


Module: icinga-core
Branch: mfriedrich/core
Commit: eeb8cde4d88be172fde573b2646dda6138ea676b
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=eeb8cde4d88be172fde573b2646dda6138ea676b

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Tue Aug 21 17:35:04 2012 +0200

core: fix compiling with embedded perl #2197

i fucked up, sorry. buy me more beer for proper code and tests :p

refs #2197

---

 base/utils.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/base/utils.c b/base/utils.c
index ef1a7b9..abfbe04 100644
--- a/base/utils.c
+++ b/base/utils.c
@@ -304,6 +304,7 @@ int my_system_r(icinga_macros *mac, char *cmd, int timeout, int *early_timeout,
 	int dbuf_chunk = 1024;
 	int flags;
 #ifdef EMBEDDEDPERL
+	char *temp_buffer = NULL;
 	char fname[512] = "";
 	char *args[5] = {"", DO_CLEAN, "", "", NULL };
 	SV *plugin_hndlr_cr = NULL; /* perl.h holds typedef struct */
@@ -3598,7 +3599,7 @@ int file_uses_embedded_perl(char *fname) {
 		return FALSE;
 
 	/* grab the first line - we should see Perl. go home if not */
-	if (fgets(line1, 80, fp) == NULL || strstr(buf, "/bin/perl") == NULL) {
+	if (fgets(buf, 80, fp) == NULL || strstr(buf, "/bin/perl") == NULL) {
 		fclose(fp);
 	}
 
@@ -3610,7 +3611,7 @@ int file_uses_embedded_perl(char *fname) {
 		buf[sizeof(buf) - 1] = '\0';
 
 		/* line contains Icinga directives - keep Nagios compatibility */
-		if (strstr(linen, "# nagios:") || strstr(linen, "# icinga:")) {
+		if (strstr(buf, "# nagios:") || strstr(buf, "# icinga:")) {
 			char *p;
 			p = strstr(buf + 8, "epn");
 			if (!p)





More information about the icinga-checkins mailing list