[Monetdb-developers] [Monetdb-checkins] MonetDB/src/testing difflib.c, , 1.46, 1.47

Fabian Groffen Fabian.Groffen at cwi.nl
Mon Sep 10 09:50:19 CEST 2007


On 09-09-2007 11:36:26 +0000, Stefan Manegold wrote:
> Update of /cvsroot/monetdb/MonetDB/src/testing
> In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv4669
> 
> Modified Files:
> 	difflib.c 
> Log Message:
> 
> no need to call "touch" via "system()" to create an empty file;
> "fclose(fopen())" should do the job within pure C.

Because you use the stream versions here, fclose(fopen()) can crash you
tool if fopen() returns NULL, as fclose doesn't grok it.

> Index: difflib.c
> ===================================================================
> RCS file: /cvsroot/monetdb/MonetDB/src/testing/difflib.c,v
> retrieving revision 1.46
> retrieving revision 1.47
> diff -u -d -r1.46 -r1.47
> --- difflib.c	5 Sep 2007 17:05:58 -0000	1.46
> +++ difflib.c	9 Sep 2007 11:36:22 -0000	1.47
> @@ -922,7 +922,7 @@
>  
>  	if (!u_diff2lwc_diff(mindiff, LWC, u_diff_fn, lwc_diff_fn))
>  		/* { UNLINK(lwc_diff_fn); ERRHNDL(0,"u_diff2lwc_diff returns 0 in u_diff2html","",1); } */
> -		SYSTEM(strconcat("touch ", lwc_diff_fn));
> +		fclose(Wfopen(lwc_diff_fn));

Unless Wfopen does something fancy with the pointer, I suggest to check
if it's non NULL.




More information about the developers-list mailing list