diff --git a/client/tarancheck/tc_config.c b/client/tarancheck/tc_config.c index 925a05ed917e338073b9dbb98616605fe6016478..c68087e988b37a091ed043ca37b84dc47120cf34 100644 --- a/client/tarancheck/tc_config.c +++ b/client/tarancheck/tc_config.c @@ -33,6 +33,8 @@ #include <stdint.h> #include <stdio.h> #include <string.h> +#include <limits.h> +#include <unistd.h> #include <cfg/prscfg.h> #include <cfg/tarantool_box_cfg.h> @@ -60,5 +62,25 @@ int tc_config_load(struct tc_options *opts) rc = check_cfg_tarantool_cfg(&opts->cfg); if (rc == -1) return -1; + + char workdir[PATH_MAX]; + + if (opts->cfg.work_dir == NULL) { + getcwd(workdir, PATH_MAX); + opts->cfg.work_dir = strndup(opts->cfg.work_dir, PATH_MAX); + } + if (opts->cfg.snap_dir == NULL) { + free(opts->cfg.snap_dir); + opts->cfg.snap_dir = strndup(opts->cfg.work_dir, PATH_MAX); + if (!opts->cfg.snap_dir) + return -1; + } + if (opts->cfg.wal_dir == NULL) { + free(opts->cfg.wal_dir); + opts->cfg.wal_dir = strndup(opts->cfg.work_dir, PATH_MAX); + if (!opts->cfg.wal_dir) + return -1; + } + return 0; } diff --git a/client/tarancheck/tc_generate.c b/client/tarancheck/tc_generate.c index 214585db749f0f678ac8d434c6f3c2da97433c31..39cdf2d35fb45df1988a1c668d694191ea63e09c 100644 --- a/client/tarancheck/tc_generate.c +++ b/client/tarancheck/tc_generate.c @@ -452,16 +452,6 @@ int tc_generate(struct tc_options *opts) struct tnt_dir snap_dir; tnt_dir_init(&snap_dir, TNT_DIR_SNAPSHOT); - if (opts->cfg.snap_dir == NULL) { - printf("snapshot directory is not specified\n"); - tc_space_free(&s); - return -1; - } - if (opts->cfg.wal_dir == NULL) { - printf("xlog directory is not specified\n"); - tc_space_free(&s); - return -1; - } rc = tnt_dir_scan(&snap_dir, opts->cfg.snap_dir); if (rc == -1) { printf("failed to open snapshot directory\n");