Nagios3-CVS Patch - Small Bug in config.c with temp_path not available

Herbert Straub herbert at linuxhacker.at
Sun Mar 25 15:14:48 CEST 2007


Hendrik Baecker wrote:

Based on your patch, i suggest this construction, to avoid open dirhandles.

Best regards
Herbert Straub
> There was a typo in my last patch according to the try to printout the
> actual temp_path value with snprintf...
>
> Please take this patch instead!
>
> Regards
> Hendrik
>   
> ------------------------------------------------------------------------
>
> --- ./nagios3-clean/base/config.c	2007-03-25 10:06:23.000000000 +0200
> +++ ./nagios3/base/config.c	2007-03-25 11:18:09.000000000 +0200
> @@ -404,6 +404,20 @@
>  				break;
>  				}
>  
> +			if(opendir((char *)value)==NULL){
> +				strcpy(error_message,"Temp path is not valid");
> +				error=TRUE;
> +				break;
> +				}
> +			// Maybe we should close the dirhandle but what to close
> +			// without a normal DIR handle?
> +			// With a temp DIR Handle there would be a new only temp variable...
> +			//
> +			// closedir(SOMESTUPID_HANDLE);
> +			//
> +			// Maybe we should check if the DIR Handle is writeable by us?
> +			// AFAIK we need <sys/stat.h> ... 
> +
>  			my_free((void **)&temp_path);
>  			if((temp_path=(char *)strdup(value))){
>  				strip(temp_path);
>   
> ------------------------------------------------------------------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: config.c.-temp_path_checking-v2-hs.patch
Type: text/x-patch
Size: 594 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20070325/7d631e49/attachment.bin>
-------------- next part --------------
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
-------------- next part --------------
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel


More information about the Developers mailing list