[Nagios-devel] [PATCH 3/3] Fix submitting service commands

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] [PATCH 3/3] Fix submitting service commands

Post by Guest »

This is a multi-part message in MIME format.
--------------030406090508040603050300
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

The big patch that reworked how command submission works
apparently broke service command submission. This patch
fixes that, and also adds the proper format attributes to
cmd_submitf() so that it won't happen again (well, assuming
one remembers to manually run the compiler with warnings
enabled anyways).

Original patch by Badri Pillai
I just added the gcc __attribute__() stuff to cmd_submitf()
to prevent this to happening for other commands as well.

Signed-off-by: Andreas Ericsson
---
cgi/cmd.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)



--------------030406090508040603050300
Content-Type: text/x-patch;
name="a34628b78ea053e0c6d486ff7e05b47dad7f943d.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="a34628b78ea053e0c6d486ff7e05b47dad7f943d.diff"

diff --git a/cgi/cmd.c b/cgi/cmd.c
index 89cb216..dadbf08 100644
--- a/cgi/cmd.c
+++ b/cgi/cmd.c
@@ -1900,6 +1900,7 @@ void commit_command_data(int cmd){
return;
}

+__attribute__((format(printf, 2, 3)))
static int cmd_submitf(int id, const char *fmt, ...)
{
char cmd[MAX_EXTERNAL_COMMAND_LENGTH];
@@ -2030,7 +2031,7 @@ int commit_command(int cmd){
break;

case CMD_ADD_SVC_COMMENT:
- result = cmd_submitf(cmd,"%s;%s;%d;%s;%s",current_time,host_name,service_desc,persistent_comment,comment_author,comment_data);
+ result = cmd_submitf(cmd,"%s;%s;%d;%s;%s",host_name,service_desc,persistent_comment,comment_author,comment_data);
break;

case CMD_DEL_HOST_COMMENT:


--------------030406090508040603050300--





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked