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.