Bugfix in reset_variables (base/utils.c)

Dirk Porezag Dirk.Porezag at matrix.ag
Sun Jan 30 23:10:44 CET 2005


While trying to get nagios 2.0 (CVS current) working on Solaris-sparc-2.8, I noticed that the children which are forked to do the actual checks die in putenv() called by set_macro_environment_var. This error results from an incorrect array initialization in reset_variables which happens much earlier. Classical C array loop index bug.
Enclosed the fix:

*** base/utils.c        Sun Jan 30 22:40:05 2005
--- base/utils.c.orig   Sun Jan 30 22:37:53 2005
***************
*** 5245,5251 ****

        date_format=DATE_FORMAT_US;

!       for(x=0;x<MACRO_X_COUNT;x++)
                macro_x[x]=NULL;

        for(x=0;x<MAX_COMMAND_ARGUMENTS;x++)
--- 5245,5251 ----

        date_format=DATE_FORMAT_US;

!       for(x=0;x<=MACRO_X_COUNT;x++)
                macro_x[x]=NULL;

        for(x=0;x<MAX_COMMAND_ARGUMENTS;x++) 


Hope this helps,
Dirk

Mit freundlichen Grüßen - Kind regards 
  
------------------------------------------------------------------- 
matrix technology AG 
Dr. Dirk Porezag 
Senior Consultant - Manager Shared Service Center 
Landsberger Str. 400-402, D-81241 München 
Tel:  +49 - (0)89 - 589395-0 
Fax: +49 - (0)89 - 589395-11 
Web:    www.matrix.ag 
E-mail:  Dirk.Porezag at matrix.ag 
------------------------------------------------------------------- 
E-Mail Disclaimer 
Der Inhalt dieser E-Mail ist ausschließlich für den bezeichneten 
Adressaten bestimmt. Wenn Sie nicht der vorgesehene Adressat 
dieser E-Mail oder dessen Vertreter sein sollten, so beachten Sie 
bitte, dass jede Form der Kenntnisnahme, Veröffentlichung, 
Vervielfältigung oder Weitergabe des Inhalts dieser E-Mail 
unzulässig ist. Wir bitten Sie, sich in diesem Fall mit dem 
Absender der E-Mail in Verbindung zu setzen. 
The information contained in this email is intended solely 
for the addressee. Access to this email by anyone else is 
unauthorized. If you are not the intended recipient, any form 
of disclosure, reproduction, distribution or any action taken 
or refrained from in reliance on it, is prohibited and may be 
unlawful. Please notify the sender immediately. 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nagios-fix.diff
Type: application/octet-stream
Size: 410 bytes
Desc: nagios-fix.diff
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20050130/7bf2c9b4/attachment.obj>


More information about the Developers mailing list