| 524 | */ |
| 525 | |
| 526 | uint build_table_filename(char *buff, size_t bufflen, const char *db, |
| 527 | const char *table_name, const char *ext, |
| 528 | uint flags, bool *was_truncated) |
| 529 | { |
| 530 | char tbbuff[FN_REFLEN], dbbuff[FN_REFLEN]; |
| 531 | uint tab_len, db_len; |
| 532 | DBUG_ENTER("build_table_filename"); |
| 533 | DBUG_PRINT("enter", ("db: '%s' table_name: '%s' ext: '%s' flags: %x", |
| 534 | db, table_name, ext, flags)); |
| 535 | |
| 536 | if (flags & FN_IS_TMP) // FN_FROM_IS_TMP | FN_TO_IS_TMP |
| 537 | tab_len= strnmov(tbbuff, table_name, sizeof(tbbuff)) - tbbuff; |
| 538 | else |
| 539 | tab_len= tablename_to_filename(table_name, tbbuff, sizeof(tbbuff)); |
| 540 | |
| 541 | db_len= tablename_to_filename(db, dbbuff, sizeof(dbbuff)); |
| 542 | |
| 543 | char *end = buff + bufflen; |
| 544 | /* Don't add FN_ROOTDIR if mysql_data_home already includes it */ |
| 545 | char *pos = strnmov(buff, mysql_data_home, bufflen); |
| 546 | size_t rootdir_len= strlen(FN_ROOTDIR); |
| 547 | if (pos - rootdir_len >= buff && |
| 548 | memcmp(pos - rootdir_len, FN_ROOTDIR, rootdir_len) != 0) |
| 549 | pos= strnmov(pos, FN_ROOTDIR, end - pos); |
| 550 | else |
| 551 | rootdir_len= 0; |
| 552 | pos= strxnmov(pos, end - pos, dbbuff, FN_ROOTDIR, NullS); |
| 553 | #ifdef USE_SYMDIR |
| 554 | if (!(flags & SKIP_SYMDIR_ACCESS)) |
| 555 | { |
| 556 | my_bool is_symdir; |
| 557 | |
| 558 | unpack_dirname(buff, buff, &is_symdir); |
| 559 | /* |
| 560 | Lack of synchronization for access to symdir_warning_emitted is OK |
| 561 | as in the worst case it might result in a few extra warnings |
| 562 | printed to error log. |
| 563 | */ |
| 564 | if (is_symdir && !symdir_warning_emitted) |
| 565 | { |
| 566 | symdir_warning_emitted= true; |
| 567 | sql_print_warning("Symbolic links based on .sym files are deprecated. " |
| 568 | "Please use native Windows symbolic links instead " |
| 569 | "(see MKLINK command)."); |
| 570 | } |
| 571 | pos= strend(buff); |
| 572 | } |
| 573 | #endif |
| 574 | pos= strxnmov(pos, end - pos, tbbuff, ext, NullS); |
| 575 | |
| 576 | /** |
| 577 | Mark OUT param if path gets truncated. |
| 578 | Most of functions which invoke this function are sure that the |
| 579 | path will not be truncated. In case some functions are not sure, |
| 580 | we can use 'was_truncated' OUTPARAM |
| 581 | */ |
| 582 | *was_truncated= false; |
| 583 | if (pos == end && |
nothing calls this directly
no test coverage detected