Patches for nagios-3.0b6

Andreas Ericsson ae at op5.se
Wed Nov 7 00:32:10 CET 2007


Lars Vogdt wrote:
> Hi
> 
> First: thanks for this great product!
> 
> I like to thank a bit with the following 3 patches for nagios-3.0b6 - 
> and would feel happy if you can apply them for the next release. 
> 
> I've got some more compiler (gcc42) warnings about implicit 
> declarations,  unused variables and ignoring function return values. 
> But I haven't investigated any time in these warnings, yet.
> 

If you could start with implicit declarations that'd be great, since
those might hide real bugs. I'm fairly certain you'd lower the
warnings for ignored return values by that too (although you almost
certainly want to disable that warning, since it's pretty common
practice to ignore return values of memcpy(), snprintf(), strcpy()
and their likes).

> 
> 2) Fix compiler warnings part 1 (string compare)
> 
> Index: cgi/avail.c
> ===================================================================
> --- cgi/avail.c.orig
> +++ cgi/avail.c
> @@ -2475,7 +2475,7 @@
>     char *last_host_name="";
> 
>     /* we're displaying one or more hosts */
> -   if(display_type==DISPLAY_HOST_AVAIL && host_name!=""){
> +   if(display_type==DISPLAY_HOST_AVAIL && (strcmp(host_name,"")!=0)){
> 

Please make this

	if (... && host_name[0] != 0)

instead, and same for the rest of the cases. If there's any doubt that
the variable is initialized, make them "(... && host_name && host_name[0] != 0)"
instead.

> 
> 3) Fix compiler warnings part 2 (variable used bevor set)
> 

This one passes the 5 minute review unmolested. Nicely done.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/




More information about the Developers mailing list