Skip to content

Commit bac7ae5

Browse files
committed
cgkrepair: scan associated and softdeleted messages as well
1 parent 4c7a393 commit bac7ae5

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tools/cgkrepair.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,22 +227,31 @@ static int inspect_folder_row(const TPROPVAL_ARRAY &props, const mboxparam &mbp)
227227
*/
228228
return 0;
229229

230+
for (unsigned int b_assoc = 0; b_assoc <= 1; ++b_assoc) {
231+
for (unsigned int b_softdel = 0; b_softdel <= 1; ++b_softdel) {
232+
230233
uint32_t table_id = 0, row_count = 0;
234+
unsigned int tbl_flags = 0;
235+
tbl_flags |= b_assoc ? TABLE_FLAG_ASSOCIATED : 0;
236+
tbl_flags |= b_softdel ? TABLE_FLAG_SOFTDELETES : 0;
231237
if (!exmdb_client->load_content_table(g_storedir, codepage, *fid,
232-
nullptr, 0, nullptr, nullptr, &table_id, &row_count))
238+
nullptr, tbl_flags, nullptr, nullptr, &table_id, &row_count))
233239
return -EIO;
240+
auto cl_0 = HX::make_scope_exit([&]() { exmdb_client->unload_table(g_storedir, table_id); });
234241
TARRAY_SET tset{};
235242
if (!exmdb_client->query_table(g_storedir, nullptr, codepage, table_id,
236243
&check_tags, 0, row_count, &tset)) {
237244
fprintf(stderr, "exm: query_table RPC failed\n");
238245
return -EIO;
239246
}
240-
exmdb_client->unload_table(g_storedir, table_id);
241247
for (size_t i = 0; i < tset.count; ++i) {
242248
auto ret = inspect_message_row(*tset.pparray[i], mbp);
243249
if (ret != 0)
244250
return ret;
245251
}
252+
253+
}
254+
}
246255
return 0;
247256
}
248257

0 commit comments

Comments
 (0)