diff options
Diffstat (limited to 'docs/examples/certinfo.c')
-rw-r--r-- | docs/examples/certinfo.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/docs/examples/certinfo.c b/docs/examples/certinfo.c index ffcec6356..ac0109b07 100644 --- a/docs/examples/certinfo.c +++ b/docs/examples/certinfo.c @@ -52,18 +52,24 @@ int main(void) res = curl_easy_perform(curl); if(!res) { - struct curl_certinfo *ci = NULL; + union { + struct curl_slist *to_info; + struct curl_certinfo *to_certinfo; + } ptr; - res = curl_easy_getinfo(curl, CURLINFO_CERTINFO, &ci); + ptr.to_info = NULL; - if(!res && ci) { + res = curl_easy_getinfo(curl, CURLINFO_CERTINFO, &ptr.to_info); + + if(!res && ptr.to_info) { int i; - printf("%d certs!\n", ci->num_of_certs); - for(i=0; i<ci->num_of_certs; i++) { + printf("%d certs!\n", ptr.to_certinfo->num_of_certs); + + for(i = 0; i < ptr.to_certinfo->num_of_certs; i++) { struct curl_slist *slist; - for(slist = ci->certinfo[i]; slist; slist = slist->next) + for(slist = ptr.to_certinfo->certinfo[i]; slist; slist = slist->next) printf("%s\n", slist->data); } @@ -71,7 +77,6 @@ int main(void) } - curl_easy_cleanup(curl); } |