Skip to content

Commit

Permalink
attempt to suppress the WARN thatpops when loading an identity as a file
Browse files Browse the repository at this point in the history
  • Loading branch information
dovholuknf committed Oct 17, 2024
1 parent 06d9006 commit 2d7e9e6
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions library/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,25 @@ int ziti_load_config(ziti_config *cfg, const char* cfgstr) {
if (!cfgstr) {
return ZITI_INVALID_CONFIG;
}
bool seems_like_json = false;
const char* c = cfgstr;
while (*cfgstr && isspace((unsigned char)*cfgstr)) {

Check warning on line 55 in library/config.c

View workflow job for this annotation

GitHub Actions / Linux ARM64

implicit declaration of function 'isspace' [-Wimplicit-function-declaration]

Check warning on line 55 in library/config.c

View workflow job for this annotation

GitHub Actions / Linux ARM

implicit declaration of function 'isspace' [-Wimplicit-function-declaration]

Check failure on line 55 in library/config.c

View workflow job for this annotation

GitHub Actions / MacOS x86_64

call to undeclared library function 'isspace' with type 'int (int)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

Check failure on line 55 in library/config.c

View workflow job for this annotation

GitHub Actions / MacOS arm64

call to undeclared library function 'isspace' with type 'int (int)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

Check warning on line 55 in library/config.c

View workflow job for this annotation

GitHub Actions / Linux x86_64

implicit declaration of function 'isspace' [-Wimplicit-function-declaration]
c++;
}
if (strncmp(c,"{",1) == 0) {
seems_like_json = true;
}

memset(cfg, 0, sizeof(*cfg));
int rc = parse_ziti_config(cfg, cfgstr, strlen(cfgstr));
int rc;
if(seems_like_json) {
rc = parse_ziti_config(cfg, cfgstr, strlen(cfgstr));

if (rc < 0) {
ZITI_LOG(DEBUG, "trying to load config from file[%s]", cfgstr);
if (rc < 0) {
ZITI_LOG(DEBUG, "trying to load config from file[%s]", cfgstr);
rc = load_config_file(cfgstr, cfg);
}
} else {
rc = load_config_file(cfgstr, cfg);
}

Expand Down

0 comments on commit 2d7e9e6

Please sign in to comment.