mirror of
https://github.com/xorgy/mediafire-fuse
synced 2026-01-13 13:14:29 -08:00
fuse: when the hashtable fails to load, start a new one instead of failing
This commit is contained in:
30
fuse/main.c
30
fuse/main.c
@@ -312,25 +312,27 @@ static void open_hashtbl(const char *dircache, const char *filecache,
|
||||
|
||||
*tree = folder_tree_load(fp, filecache);
|
||||
|
||||
if (*tree == NULL) {
|
||||
fprintf(stderr, "cannot load directory hashtable\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
||||
// TODO: make the maximum cache size configurable
|
||||
// size is given in bytes and current default is 1 GiB
|
||||
folder_tree_cleanup_filecache(*tree, 1073741824);
|
||||
if (*tree != NULL) {
|
||||
|
||||
folder_tree_update(*tree, conn, false);
|
||||
} else {
|
||||
// file doesn't exist
|
||||
fprintf(stderr, "creating new hashtable\n");
|
||||
*tree = folder_tree_create(filecache);
|
||||
// TODO: make the maximum cache size configurable
|
||||
// size is given in bytes and current default is 1 GiB
|
||||
folder_tree_cleanup_filecache(*tree, 1073741824);
|
||||
|
||||
folder_tree_rebuild(*tree, conn);
|
||||
folder_tree_update(*tree, conn, false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(stderr, "cannot load directory hashtable - starting"
|
||||
" a new one\n");
|
||||
}
|
||||
// file doesn't exist or is corrupt
|
||||
fprintf(stderr, "creating new hashtable\n");
|
||||
*tree = folder_tree_create(filecache);
|
||||
|
||||
folder_tree_rebuild(*tree, conn);
|
||||
|
||||
//folder_tree_housekeep(tree);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user