From: Hans-Bernhard B. <br...@us...> - 2008-03-12 22:40:54
|
Update of /cvsroot/cscope/cscope/src In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv3355 Modified Files: build.c Log Message: Amend and extend previous fix for fgets() breaking directory/file list comparisons Index: build.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/build.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** build.c 10 Mar 2008 18:33:47 -0000 1.13 --- build.c 12 Mar 2008 22:40:47 -0000 1.14 *************** *** 116,123 **** char oldname[PATHLEN + 1]; /* name in old cross-reference */ int oldcount; ! int i, matchcnt; /* see if the number of names is the same */ ! if (fscanf(oldrefs, "%d\n", &oldcount) != 1 || oldcount != count) { return(NO); --- 116,123 ---- char oldname[PATHLEN + 1]; /* name in old cross-reference */ int oldcount; ! int i; /* see if the number of names is the same */ ! if (fscanf(oldrefs, "%d", &oldcount) != 1 || oldcount != count) { return(NO); *************** *** 125,130 **** /* see if the name list is the same */ for (i = 0; i < count; ++i) { ! matchcnt = fscanf(oldrefs,"%s\n",oldname); ! if ((! matchcnt) || strnotequal(oldname, names[i])) { return(NO); --- 125,129 ---- /* see if the name list is the same */ for (i = 0; i < count; ++i) { ! if ((1 != fscanf(oldrefs," %[^\n]",oldname)) || strnotequal(oldname, names[i])) { return(NO); *************** *** 307,314 **** none have been changed up to the included files */ for (i = 0; i < nsrcfiles; ++i) { ! if (! fgets(oldname, sizeof(oldname), oldrefs) || ! strnotequal(oldname, srcfiles[i]) || ! lstat(srcfiles[i], &statstruct) != 0 || ! statstruct.st_mtime > reftime) { goto outofdate; } --- 306,314 ---- none have been changed up to the included files */ for (i = 0; i < nsrcfiles; ++i) { ! if ((1 != fscanf(oldrefs," %[^\n]",oldname)) ! || strnotequal(oldname, srcfiles[i]) ! || (lstat(srcfiles[i], &statstruct) != 0) ! || (statstruct.st_mtime > reftime) ! ) { goto outofdate; } *************** *** 340,345 **** oldfile = getoldfile(); } else { /* force cross-referencing of all the source files */ ! force: reftime = 0; ! oldfile = NULL; } /* open the new cross-reference file */ --- 340,346 ---- oldfile = getoldfile(); } else { /* force cross-referencing of all the source files */ ! force: ! reftime = 0; ! oldfile = NULL; } /* open the new cross-reference file */ |