Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaUnisikhin committed Jan 24, 2024
1 parent 7420b6a commit bfdaccf
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions sources/config_reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ static od_keyword_t od_role_keywords[] = {
};

static inline int od_config_reader_watchdog(od_config_reader_t *reader,
od_storage_watchdog_t *watchdog,
od_storage_watchdog_t *watchdog, char* storage_name,
od_extention_t *extentions);

static int od_config_reader_open(od_config_reader_t *reader, char *config_file)
Expand Down Expand Up @@ -891,7 +891,7 @@ static int od_config_reader_storage(od_config_reader_t *reader,
if (storage->watchdog == NULL) {
return NOT_OK_RESPONSE;
}
if (od_config_reader_watchdog(reader, storage->watchdog,
if (od_config_reader_watchdog(reader, storage->watchdog, storage->name,
extentions) ==
NOT_OK_RESPONSE)
return NOT_OK_RESPONSE;
Expand Down Expand Up @@ -1728,11 +1728,26 @@ static int od_config_reader_route(od_config_reader_t *reader, char *db_name,
}

static inline int od_config_reader_watchdog(od_config_reader_t *reader,
od_storage_watchdog_t *watchdog,
od_storage_watchdog_t *watchdog, char* storage_name,
od_extention_t *extentions)
{
watchdog->route_usr = "watchdog_int";
watchdog->route_db = "watchdog_int";
char *watchdog_prefix = "watchdog_";
int watchdog_prefix_len = strlen(watchdog_prefix);
int storage_name_len = strlen(storage_name);

char route_usr[watchdog_prefix_len + storage_name_len + 1];
char route_db[watchdog_prefix_len + storage_name_len + 1];
snprintf(route_usr, sizeof route_usr, "%s%s", watchdog_prefix, storage_name);
snprintf(route_db, sizeof route_db, "%s%s", watchdog_prefix, storage_name);

watchdog->route_usr = strdup(route_usr);
if (watchdog->route_usr == NULL)
return NOT_OK_RESPONSE;

watchdog->route_db = strdup(route_db);
if (watchdog->route_db == NULL)
return NOT_OK_RESPONSE;

int user_name_len = 0;
user_name_len = strlen(watchdog->route_usr);

Expand Down

0 comments on commit bfdaccf

Please sign in to comment.