seedDB building: detect empty seeddb

This commit is contained in:
d0k3 2018-03-19 01:11:48 +01:00
parent 46090fde0a
commit 3b5755fc28

View File

@ -2085,17 +2085,19 @@ u32 BuildSeedInfo(const char* path, bool dump) {
if (dump) { if (dump) {
u32 dump_size = SEEDDB_SIZE(seed_info); u32 dump_size = SEEDDB_SIZE(seed_info);
u32 ret = 0;
if (dump_size > 16) { if (dump_size > 16) {
if (fvx_rmkdir(OUTPUT_PATH) != FR_OK) // ensure the output dir exists if (fvx_rmkdir(OUTPUT_PATH) != FR_OK) // ensure the output dir exists
return 1; ret = 1;
f_unlink(path_out); f_unlink(path_out);
if (fvx_qwrite(path_out, seed_info, 0, dump_size, NULL) != FR_OK) if (fvx_qwrite(path_out, seed_info, 0, dump_size, NULL) != FR_OK)
return 1; ret = 1;
} } else ret = 1;
free(seed_info); free(seed_info);
seed_info = NULL; seed_info = NULL;
return ret;
} }
return 0; return 0;