diff options
author | Daiki Ueno <ueno@gnu.org> | 2020-05-30 10:22:18 +0000 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2020-05-30 10:22:18 +0000 |
commit | 0023cf81f50d1c7e85083cf4398bfa6edf30d639 (patch) | |
tree | 0185f8c419e82fc9dcd60c9653eaf44d14830cee /doc | |
parent | 2f28cf6e7304a0f8b3c08823846752a2b55aabcf (diff) | |
parent | 14e2203ce5d7a6bbe050861a1206873a040674e3 (diff) | |
download | gnutls-0023cf81f50d1c7e85083cf4398bfa6edf30d639.tar.gz |
Merge branch 'tmp-fileio' into 'master'
lib: improve external file loading
See merge request gnutls/gnutls!1261
Diffstat (limited to 'doc')
-rw-r--r-- | doc/examples/ex-ocsp-client.c | 2 | ||||
-rw-r--r-- | doc/examples/ex-pkcs12.c | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/doc/examples/ex-ocsp-client.c b/doc/examples/ex-ocsp-client.c index 33eff67a6c..f0b56fffe2 100644 --- a/doc/examples/ex-ocsp-client.c +++ b/doc/examples/ex-ocsp-client.c @@ -183,7 +183,7 @@ static gnutls_x509_crt_t load_cert(const char *cert_file) if (ret < 0) exit(1); - data.data = (void *) read_binary_file(cert_file, &size); + data.data = (void *) read_file(cert_file, RF_BINARY, &size); data.size = size; if (!data.data) { diff --git a/doc/examples/ex-pkcs12.c b/doc/examples/ex-pkcs12.c index 7890518f94..0e2b64ee1c 100644 --- a/doc/examples/ex-pkcs12.c +++ b/doc/examples/ex-pkcs12.c @@ -28,7 +28,7 @@ write_pkcs12(const gnutls_datum_t * cert, gnutls_pkcs12_bag_t bag, key_bag; char pkcs12_struct[10 * 1024]; size_t pkcs12_struct_size; - FILE *fd; + FILE *fp; /* A good idea might be to use gnutls_x509_privkey_get_key_id() * to obtain a unique ID. @@ -116,13 +116,13 @@ write_pkcs12(const gnutls_datum_t * cert, return 1; } - fd = fopen(OUTFILE, "w"); - if (fd == NULL) { + fp = fopen(OUTFILE, "w"); + if (fp == NULL) { fprintf(stderr, "cannot open file\n"); return 1; } - fwrite(pkcs12_struct, 1, pkcs12_struct_size, fd); - fclose(fd); + fwrite(pkcs12_struct, 1, pkcs12_struct_size, fp); + fclose(fp); gnutls_pkcs12_bag_deinit(bag); gnutls_pkcs12_bag_deinit(key_bag); |