Made magic cleanup in fdb permanent

This commit is contained in:
Michiel Broek 2004-09-25 11:02:29 +00:00
parent b605aba2d0
commit 75051be04a
2 changed files with 63 additions and 76 deletions

View File

@ -34,8 +34,8 @@ v0.61.4 11-Aug-2004
cleaned magic aliases.
Fixed a problem with the files database were the temp file used
for sorting and inserting files didn't close the temp file.
Changed method of inserting new files that now hopefully old
magic names are really cleared.
Changed method of inserting new files so that old magic names
are really cleared.
mbcico:
Removed a little debug logging.

View File

@ -258,9 +258,6 @@ int mbsedb_InsertFDB(struct _fdbarea *fdb_area, struct FILE_record frec, int Add
}
} while ((!Found) && (!Done));
Syslog('f', "mbsedb_InsertFDB: insertpoint=%d, found=%s, done=%s", Insert, Found?"true":"false", Done?"true":"false");
// if (Found) {
if ((fp = fopen(temp, "a+")) == NULL) {
WriteError("$Can't create %s", temp);
mbsedb_UnlockFDB(fdb_area);
@ -276,8 +273,7 @@ int mbsedb_InsertFDB(struct _fdbarea *fdb_area, struct FILE_record frec, int Add
for (i = 0; i < Insert; i++) {
fread(&fdb, fdbhdr.recsize, 1, fdb_area->fp);
/*
* If we see a magic that is the new magic, remove
* the old one.
* If we see a magic that is the new magic, remove the old one.
*/
if (strlen(frec.Magic) && (strcmp(fdb.Magic, frec.Magic) == 0)) {
Syslog('f', "Clear magic %s file %s", fdb.Magic, fdb.LName);
@ -305,8 +301,7 @@ int mbsedb_InsertFDB(struct _fdbarea *fdb_area, struct FILE_record frec, int Add
*/
while (fread(&fdb, fdbhdr.recsize, 1, fdb_area->fp) == 1) {
/*
* If we see a magic that is the new magic, remove
* the old one.
* If we see a magic that is the new magic, remove the old one.
*/
if (strlen(frec.Magic) && (strcmp(fdb.Magic, frec.Magic) == 0)) {
Syslog('f', "Clear magic %s file %s", fdb.Magic, fdb.LName);
@ -333,14 +328,6 @@ int mbsedb_InsertFDB(struct _fdbarea *fdb_area, struct FILE_record frec, int Add
mbsedb_Temp2Data(fdb_area->area);
fdb_area->fp = fp;
fdb_area->locked = 0;
// } else {
/*
* Append new entry
*/
// fseek(fdb_area->fp, 0, SEEK_END);
// fwrite(&frec, fdbhdr.recsize, 1, fdb_area->fp);
// }
free(temp);
return TRUE;