diff options
author | Werner Koch <wk@gnupg.org> | 2020-11-11 15:22:51 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2020-11-11 15:23:22 +0100 |
commit | d574213ce21c495d9432eeb5956e8857826876c6 (patch) | |
tree | e5ca4539906ac55975683f6163853f1bd6b5c2c0 /kbx/kbxutil.c | |
parent | gpg: Fix the previous commit. (diff) | |
download | gnupg2-d574213ce21c495d9432eeb5956e8857826876c6.tar.xz gnupg2-d574213ce21c495d9432eeb5956e8857826876c6.zip |
w32: Replace some fopen by es_fopen.
* agent/protect-tool.c (read_file): Replace fopen by es_fopen.
* dirmngr/dirmngr-client.c (read_pem_certificate): Ditto.
(read_certificate): Ditto.
* g10/keydb.c (rt_from_file): Ditto.
* kbx/kbxutil.c (read_file): Ditto.
* g10/plaintext.c (get_output_file) [__riscos__]: Remove code.
Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to '')
-rw-r--r-- | kbx/kbxutil.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/kbx/kbxutil.c b/kbx/kbxutil.c index c76809bc4..911514406 100644 --- a/kbx/kbxutil.c +++ b/kbx/kbxutil.c @@ -238,7 +238,7 @@ format_keyid ( const char *s, u32 *kid ) static char * read_file (const char *fname, size_t *r_length) { - FILE *fp; + estream_t fp; char *buf; size_t buflen; @@ -246,7 +246,7 @@ read_file (const char *fname, size_t *r_length) { size_t nread, bufsize = 0; - fp = stdin; + fp = es_stdin; buf = NULL; buflen = 0; #define NCHUNK 8192 @@ -260,8 +260,8 @@ read_file (const char *fname, size_t *r_length) if (!buf) log_fatal ("can't allocate buffer: %s\n", strerror (errno)); - nread = fread (buf+buflen, 1, NCHUNK, fp); - if (nread < NCHUNK && ferror (fp)) + nread = es_fread (buf+buflen, 1, NCHUNK, fp); + if (nread < NCHUNK && es_ferror (fp)) { log_error ("error reading '[stdin]': %s\n", strerror (errno)); xfree (buf); @@ -277,17 +277,17 @@ read_file (const char *fname, size_t *r_length) { struct stat st; - fp = fopen (fname, "rb"); + fp = es_fopen (fname, "rb"); if (!fp) { log_error ("can't open '%s': %s\n", fname, strerror (errno)); return NULL; } - if (fstat (fileno(fp), &st)) + if (fstat (es_fileno(fp), &st)) { log_error ("can't stat '%s': %s\n", fname, strerror (errno)); - fclose (fp); + es_fclose (fp); return NULL; } @@ -295,14 +295,14 @@ read_file (const char *fname, size_t *r_length) buf = xtrymalloc (buflen+1); if (!buf) log_fatal ("can't allocate buffer: %s\n", strerror (errno)); - if (fread (buf, buflen, 1, fp) != 1) + if (es_fread (buf, buflen, 1, fp) != 1) { log_error ("error reading '%s': %s\n", fname, strerror (errno)); - fclose (fp); + es_fclose (fp); xfree (buf); return NULL; } - fclose (fp); + es_fclose (fp); } *r_length = buflen; |