mbfile checks now double filerecords
This commit is contained in:
@@ -204,8 +204,21 @@ void Check(void)
|
||||
rewind(pFile);
|
||||
while (fread(&file, sizeof(file), 1, pFile) == 1) {
|
||||
if (strcmp(file.LName, de->d_name) == 0) {
|
||||
if (!Found) {
|
||||
Found = TRUE;
|
||||
break;
|
||||
} else {
|
||||
/*
|
||||
* Record has been found before, so this must be
|
||||
* a double record.
|
||||
*/
|
||||
Syslog('!', "Double file record area %d file %s",
|
||||
i, file.LName);
|
||||
iErrors++;
|
||||
file.Double = TRUE;
|
||||
do_pack = TRUE;
|
||||
fseek(pFile, - sizeof(file), SEEK_CUR);
|
||||
fwrite(&file, sizeof(file), 1, pFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((!Found) &&
|
||||
|
@@ -112,20 +112,24 @@ void PackFileBase(void)
|
||||
|
||||
iTotal++;
|
||||
|
||||
if ((!file.Deleted) && (strcmp(file.Name, "") != 0)) {
|
||||
if ((!file.Deleted) && (!file.Double) && (strcmp(file.Name, "") != 0)) {
|
||||
fwrite(&file, sizeof(file), 1, fp);
|
||||
} else {
|
||||
iRemoved++;
|
||||
Syslog('+', "Removed file \"%s\" from area %d", file.LName, i);
|
||||
sprintf(fn, "%s/%s", area.Path, file.LName);
|
||||
rc = unlink(fn);
|
||||
if (rc)
|
||||
Syslog('+', "Unlink %s failed, result %d", fn, rc);
|
||||
/*
|
||||
* If a dotted version (thumbnail) exists, remove it silently
|
||||
*/
|
||||
sprintf(fn, "%s/.%s", area.Path, file.LName);
|
||||
unlink(fn);
|
||||
if (file.Double) {
|
||||
Syslog('+', "Removed double record file \"%s\" from area %d", file.LName, i);
|
||||
} else {
|
||||
Syslog('+', "Removed file \"%s\" from area %d", file.LName, i);
|
||||
sprintf(fn, "%s/%s", area.Path, file.LName);
|
||||
rc = unlink(fn);
|
||||
if (rc)
|
||||
Syslog('+', "Unlink %s failed, result %d", fn, rc);
|
||||
/*
|
||||
* If a dotted version (thumbnail) exists, remove it silently
|
||||
*/
|
||||
sprintf(fn, "%s/.%s", area.Path, file.LName);
|
||||
unlink(fn);
|
||||
}
|
||||
do_index = TRUE;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user