td-459: TSDB_FILENAME_LEN
This commit is contained in:
parent
ab7b7f42e9
commit
33819c0b3a
|
@ -29,7 +29,7 @@ int32_t main(int32_t argc, char *argv[]) {
|
|||
for (int32_t i = 1; i < argc; ++i) {
|
||||
if (strcmp(argv[i], "-c") == 0) {
|
||||
if (i < argc - 1) {
|
||||
if (strlen(argv[++i]) > TSDB_FILENAME_LEN - 1) {
|
||||
if (strlen(argv[++i]) >= TSDB_FILENAME_LEN) {
|
||||
printf("config file path overflow");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ void shellParseArgument(int argc, char *argv[], struct arguments *arguments) {
|
|||
}
|
||||
} else if (strcmp(argv[i], "-c") == 0) {
|
||||
if (i < argc - 1) {
|
||||
if (strlen(argv[++i]) > TSDB_FILENAME_LEN - 1) {
|
||||
if (strlen(argv[++i]) >= TSDB_FILENAME_LEN) {
|
||||
fprintf(stderr, "config file path: %s overflow max len %d\n", argv[i], TSDB_FILENAME_LEN - 1);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
|
|||
fprintf(stderr, "Invalid path %s\n", arg);
|
||||
return -1;
|
||||
}
|
||||
if (strlen(full_path.we_wordv[0]) > TSDB_FILENAME_LEN - 1) {
|
||||
if (strlen(full_path.we_wordv[0]) >= TSDB_FILENAME_LEN) {
|
||||
fprintf(stderr, "config file path: %s overflow max len %d\n", full_path.we_wordv[0], TSDB_FILENAME_LEN - 1);
|
||||
wordfree(&full_path);
|
||||
return -1;
|
||||
|
|
|
@ -77,7 +77,7 @@ void shellParseArgument(int argc, char *argv[], struct arguments *arguments) {
|
|||
}
|
||||
} else if (strcmp(argv[i], "-c") == 0) {
|
||||
if (i < argc - 1) {
|
||||
if (strlen(argv[++i]) > TSDB_FILENAME_LEN - 1) {
|
||||
if (strlen(argv[++i]) >= TSDB_FILENAME_LEN) {
|
||||
fprintf(stderr, "config file path: %s overflow max len %d\n", argv[i], TSDB_FILENAME_LEN - 1);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
|
|
@ -177,8 +177,8 @@ typedef struct SDumpArguments {
|
|||
char *password;
|
||||
uint16_t port;
|
||||
// output file
|
||||
char output[TSDB_FILENAME_LEN + 1];
|
||||
char input[TSDB_FILENAME_LEN + 1];
|
||||
char output[TSDB_FILENAME_LEN];
|
||||
char input[TSDB_FILENAME_LEN];
|
||||
char *encode;
|
||||
// dump unit option
|
||||
bool all_databases;
|
||||
|
|
|
@ -242,7 +242,7 @@ void taosReadGlobalLogCfg() {
|
|||
wordexp_t full_path;
|
||||
wordexp(configDir, &full_path, 0);
|
||||
if (full_path.we_wordv != NULL && full_path.we_wordv[0] != NULL) {
|
||||
if (strlen(full_path.we_wordv[0]) > TSDB_FILENAME_LEN - 1) {
|
||||
if (strlen(full_path.we_wordv[0]) >= TSDB_FILENAME_LEN) {
|
||||
printf("\nconfig file: %s path overflow max len %d, all variables are set to default\n", full_path.we_wordv[0], TSDB_FILENAME_LEN - 1);
|
||||
wordfree(&full_path);
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue