[PATCH 3/3] Patch to mini_epn to allow any command line length

Thomas Guyot-Sionnest dermoth at aei.ca
Thu Aug 5 13:07:38 CEST 2010


---
 Changelog          |    1 +
 contrib/mini_epn.c |    8 +++++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Changelog b/Changelog
index 54cd941..466bb7e 100644
--- a/Changelog
+++ b/Changelog
@@ -7,6 +7,7 @@ Nagios 3.x Change Log
 ------------------
 ENHANCEMENTS
 * Patch to new_mini_epn to allow any command line length without breaking on extra trailing or leading whitespace (Ray Bengen)
+* Patch to mini_epn to allow any command line length (Thomas Guyot-Sionnest)
 * Patch to speed up loading of state retention data (Matthieu Kermagoret)
 * Custom notifications are now suppressed during scheduled downtime (Sven Nierlein)
 
diff --git a/contrib/mini_epn.c b/contrib/mini_epn.c
index 598e239..1e4f72e 100644
--- a/contrib/mini_epn.c
+++ b/contrib/mini_epn.c
@@ -7,6 +7,8 @@
 #include <perl.h>
 #include "epn_nagios.h"
 
+#define MAX_INPUT_CHARS 1024
+
 static PerlInterpreter *my_perl = NULL;
 
 int main(int argc, char **argv, char **env) {
@@ -19,9 +21,9 @@ int main(int argc, char **argv, char **env) {
 
 	char *embedding[] = { "", "p1.pl" };
 	char *plugin_output ;
-	char fname[64];
+	char fname[MAX_INPUT_CHARS];
 	char *args[] = {"","0", "", "", NULL };
-	char command_line[80];
+	char command_line[MAX_INPUT_CHARS];
 	int exitstatus;
 	int pclose_result;
 
@@ -35,7 +37,7 @@ int main(int argc, char **argv, char **env) {
 
 		exitstatus=perl_run(my_perl);
 
-	        while(printf("Enter file name: ") && fgets(command_line, 80, stdin)) {
+	        while(printf("Enter file name: ") && fgets(command_line, MAX_INPUT_CHARS-1, stdin)) {
 			SV *plugin_hndlr_cr;
 		        STRLEN n_a;
 			int count = 0 ;
-- 
1.7.1


------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm




More information about the Developers mailing list