Avoid hard-coding any paths and use the function which is portable across operating systems.
25 lines
858 B
XML
25 lines
858 B
XML
<?xml version='1.0' encoding='utf-8' ?>
|
|
<!DOCTYPE programlisting PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
|
]>
|
|
<!-- Automatically generated file. Do not edit. -->
|
|
<programlisting language="C">
|
|
// Load the trusted CA certificates.
|
|
gnutls_certificate_credentials_t cred = NULL;
|
|
int ret = gnutls_certificate_allocate_credentials (&cred);
|
|
if (ret != GNUTLS_E_SUCCESS) {
|
|
fprintf(stderr, "error: gnutls_certificate_allocate_credentials: %s\n",
|
|
gnutls_strerror(ret));
|
|
exit(1);
|
|
}
|
|
|
|
ret = gnutls_certificate_set_x509_system_trust(cred);
|
|
if (ret == 0) {
|
|
fprintf(stderr, "error: no certificates found in system trust store\n");
|
|
exit(1);
|
|
}
|
|
if (ret < 0) {
|
|
fprintf(stderr, "error: gnutls_certificate_set_x509_system_trust: %s\n",
|
|
gnutls_strerror(ret));
|
|
exit(1);
|
|
}
|
|
</programlisting>
|