diff options
author | Daniel Stenberg <daniel@haxx.se> | 2017-06-01 15:03:30 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2017-06-01 21:06:09 +0200 |
commit | efc7c1d86f1543870712d1a0ef4eecd67e933921 (patch) | |
tree | 17ce234c855375f1378ee598b9bcf003c51d5531 /docs/examples | |
parent | 4eafc6c249cd390938cc3216e07571e0fc885bb3 (diff) |
typecheck-gcc.h: check CURLINFO_CERTINFO
... and update the certinfo.c example accordingly.
Fixes https://github.com/curl/curl/issues/846
Diffstat (limited to 'docs/examples')
-rw-r--r-- | docs/examples/certinfo.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/docs/examples/certinfo.c b/docs/examples/certinfo.c index de2e31088..1aee614ce 100644 --- a/docs/examples/certinfo.c +++ b/docs/examples/certinfo.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -56,24 +56,19 @@ int main(void) res = curl_easy_perform(curl); if(!res) { - union { - struct curl_slist *to_info; - struct curl_certinfo *to_certinfo; - } ptr; + struct curl_certinfo *certinfo; - ptr.to_info = NULL; + res = curl_easy_getinfo(curl, CURLINFO_CERTINFO, &certinfo); - res = curl_easy_getinfo(curl, CURLINFO_CERTINFO, &ptr.to_info); - - if(!res && ptr.to_info) { + if(!res && certinfo) { int i; - printf("%d certs!\n", ptr.to_certinfo->num_of_certs); + printf("%d certs!\n", certinfo->num_of_certs); - for(i = 0; i < ptr.to_certinfo->num_of_certs; i++) { + for(i = 0; i < certinfo->num_of_certs; i++) { struct curl_slist *slist; - for(slist = ptr.to_certinfo->certinfo[i]; slist; slist = slist->next) + for(slist = certinfo->certinfo[i]; slist; slist = slist->next) printf("%s\n", slist->data); } |