Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attempt to suppress the WARN thatpops when loading an identity as a file #756

Merged
merged 4 commits into from
Oct 17, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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]
dovholuknf marked this conversation as resolved.
Show resolved Hide resolved
c++;
}
if (strncmp(c,"{",1) == 0) {
dovholuknf marked this conversation as resolved.
Show resolved Hide resolved
seems_like_json = true;
}

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whitespace

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
Loading