| 356 | } |
| 357 | |
| 358 | bool check_usenames(const std::string& dbname, const std::string& dbdir, bool nonames) { |
| 359 | int rc; |
| 360 | struct stat st; |
| 361 | bool found_usenames = false; |
| 362 | bool found_nonames = false; |
| 363 | |
| 364 | rc = stat((dbdir + "/" + dbname + ".txn").c_str(), &st); |
| 365 | if (rc == 0 && S_ISDIR(st.st_mode)) { |
| 366 | rc = stat((dbdir + "/" + dbname + ".txn/checkpoint").c_str(), &st); |
| 367 | if (rc == 0 && S_ISREG(st.st_mode)) |
| 368 | found_usenames = true; |
| 369 | } |
| 370 | |
| 371 | rc = stat((dbdir + "/" + "logs").c_str(), &st); |
| 372 | if (rc == 0 && S_ISDIR(st.st_mode)) { |
| 373 | rc = stat((dbdir + "/" + "logs/checkpoint").c_str(), &st); |
| 374 | if (rc == 0 && S_ISREG(st.st_mode)) |
| 375 | found_nonames = true; |
| 376 | } |
| 377 | |
| 378 | /* bias by parse_lrl_file told us, but use the other if we can find it */ |
| 379 | if (nonames && found_nonames == false && found_usenames == true) |
| 380 | nonames = false; |
| 381 | |
| 382 | if (nonames == false && found_usenames == false && found_nonames == true) |
| 383 | nonames = true; |
| 384 | |
| 385 | return nonames; |
| 386 | } |
no test coverage detected