Ralph Rößner wrote:
> Hi list,
>
> while upgrading to Nagios v3 I have run into phantom circular host
> dependencies (i.e. host A depends on host C, host B depends on host C,
> nagios reports a circular dependency). Tracing the unexpected behaviour
> has lead to this code in base/config.c (ll 2493-2501 in HEAD):
>
>
> /* find the dependent host */
> temp_host=find_host(temp_hd->dependent_host_name);
> if(temp_host==NULL){
> logit(NSLOG_VERIFICATION_ERROR,TRUE,"Error: Dependent host specified in host dependency for host '%s' is not defined anywhere!",temp_hd->dependent_host_name);
> errors++;
> }
>
> /* save pointer for later */
> temp_hd->dependent_host_ptr=temp_host2;
>
>
> You see that the looked up host is assigned to "temp_host" but saved for
> later use in the dependency detection code is "temp_host2", which has
> more or less random content at this time.
>
Good eyes. The attached patch looks obviously correct.
> Applying the following patch has restored the expected behaviour for me:
>
>
> --- nagios-cvs/base/config.c.orig 2008-04-03 15:35:31.000000000 +0200
> +++ nagios-cvs/base/config.c 2008-04-03 15:35:34.000000000 +0200
> @@ -2498,7 +2498,7 @@
> }
>
> /* save pointer for later */
> - temp_hd->dependent_host_ptr=temp_host2;
> + temp_hd->dependent_host_ptr=temp_host;
>
> /* find the host we're depending on */
> temp_host2=find_host(temp_hd->host_name);
>
>
--
Andreas Ericsson [email protected]
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]