Made magic cleanup in fdb permanent
This commit is contained in:
parent
b605aba2d0
commit
75051be04a
@ -34,8 +34,8 @@ v0.61.4 11-Aug-2004
|
|||||||
cleaned magic aliases.
|
cleaned magic aliases.
|
||||||
Fixed a problem with the files database were the temp file used
|
Fixed a problem with the files database were the temp file used
|
||||||
for sorting and inserting files didn't close the temp file.
|
for sorting and inserting files didn't close the temp file.
|
||||||
Changed method of inserting new files that now hopefully old
|
Changed method of inserting new files so that old magic names
|
||||||
magic names are really cleared.
|
are really cleared.
|
||||||
|
|
||||||
mbcico:
|
mbcico:
|
||||||
Removed a little debug logging.
|
Removed a little debug logging.
|
||||||
|
17
lib/dbfdb.c
17
lib/dbfdb.c
@ -258,9 +258,6 @@ int mbsedb_InsertFDB(struct _fdbarea *fdb_area, struct FILE_record frec, int Add
|
|||||||
}
|
}
|
||||||
} while ((!Found) && (!Done));
|
} 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) {
|
if ((fp = fopen(temp, "a+")) == NULL) {
|
||||||
WriteError("$Can't create %s", temp);
|
WriteError("$Can't create %s", temp);
|
||||||
mbsedb_UnlockFDB(fdb_area);
|
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++) {
|
for (i = 0; i < Insert; i++) {
|
||||||
fread(&fdb, fdbhdr.recsize, 1, fdb_area->fp);
|
fread(&fdb, fdbhdr.recsize, 1, fdb_area->fp);
|
||||||
/*
|
/*
|
||||||
* If we see a magic that is the new magic, remove
|
* If we see a magic that is the new magic, remove the old one.
|
||||||
* the old one.
|
|
||||||
*/
|
*/
|
||||||
if (strlen(frec.Magic) && (strcmp(fdb.Magic, frec.Magic) == 0)) {
|
if (strlen(frec.Magic) && (strcmp(fdb.Magic, frec.Magic) == 0)) {
|
||||||
Syslog('f', "Clear magic %s file %s", fdb.Magic, fdb.LName);
|
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) {
|
while (fread(&fdb, fdbhdr.recsize, 1, fdb_area->fp) == 1) {
|
||||||
/*
|
/*
|
||||||
* If we see a magic that is the new magic, remove
|
* If we see a magic that is the new magic, remove the old one.
|
||||||
* the old one.
|
|
||||||
*/
|
*/
|
||||||
if (strlen(frec.Magic) && (strcmp(fdb.Magic, frec.Magic) == 0)) {
|
if (strlen(frec.Magic) && (strcmp(fdb.Magic, frec.Magic) == 0)) {
|
||||||
Syslog('f', "Clear magic %s file %s", fdb.Magic, fdb.LName);
|
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);
|
mbsedb_Temp2Data(fdb_area->area);
|
||||||
fdb_area->fp = fp;
|
fdb_area->fp = fp;
|
||||||
fdb_area->locked = 0;
|
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);
|
free(temp);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
Reference in New Issue
Block a user