mbfile checks now double filerecords
This commit is contained in:
parent
dfaee3d490
commit
7195d79c86
@ -4514,7 +4514,7 @@ v0.33.19 26-Oct-2001
|
||||
linewrap. Experimental.
|
||||
|
||||
mbfile:
|
||||
During check the file databases are reset to filemode 0660.
|
||||
During checks the file databases are reset to filemode 0660.
|
||||
Implemented "mbfile adopt" function.
|
||||
Started working on long filename support. The real name on
|
||||
disk is the long filename, the database records also holds
|
||||
@ -4544,6 +4544,8 @@ v0.33.19 26-Oct-2001
|
||||
filebases.
|
||||
Added standard doctype header and commentline to the html
|
||||
pages.
|
||||
The mbfile check function deletes double filerecords in the
|
||||
database.
|
||||
|
||||
mball:
|
||||
The index function is now obsolete, this is added to mbfile.
|
||||
|
@ -424,6 +424,7 @@ struct FILERecord {
|
||||
unsigned Missing : 1; /* Missing */
|
||||
unsigned NoKill : 1; /* Cannot be deleted */
|
||||
unsigned Announced : 1; /* File is announced */
|
||||
unsigned Double : 1; /* Double record */
|
||||
};
|
||||
|
||||
|
||||
|
@ -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