diff options
| author | Werner Koch <[email protected]> | 2020-10-20 09:52:16 +0000 |
|---|---|---|
| committer | Werner Koch <[email protected]> | 2020-10-20 10:15:56 +0000 |
| commit | 390497ea115e1aca93feec297a5bd6ae7b1ba6dd (patch) | |
| tree | 675448ff809e3f333bba4918e4787eacda7f8190 /kbx/keybox-dump.c | |
| parent | Replace all calls to access by gnupg_access (diff) | |
| download | gnupg-390497ea115e1aca93feec297a5bd6ae7b1ba6dd.tar.gz gnupg-390497ea115e1aca93feec297a5bd6ae7b1ba6dd.zip | |
Replace most of the remaining stdio calls by estream calls.
--
We need to use es_fopen on Windows to cope with non-ascii file names.
This is quite a large but fortunately straightforward change. At a
very few places we keep using stdio (for example due to the use of
popen).
GnuPG-bug-id: 5098
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'kbx/keybox-dump.c')
| -rw-r--r-- | kbx/keybox-dump.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/kbx/keybox-dump.c b/kbx/keybox-dump.c index a12d683ea..3e66b72a1 100644 --- a/kbx/keybox-dump.c +++ b/kbx/keybox-dump.c @@ -647,18 +647,18 @@ update_stats (KEYBOXBLOB blob, struct file_stats_s *s) -static FILE * +static estream_t open_file (const char **filename, FILE *outfp) { - FILE *fp; + estream_t fp; if (!*filename) { *filename = "-"; - fp = stdin; + fp = es_stdin; } else - fp = fopen (*filename, "rb"); + fp = es_fopen (*filename, "rb"); if (!fp) { int save_errno = errno; @@ -673,7 +673,7 @@ open_file (const char **filename, FILE *outfp) int _keybox_dump_file (const char *filename, int stats_only, FILE *outfp) { - FILE *fp; + estream_t fp; KEYBOXBLOB blob; int rc; unsigned long count = 0; @@ -726,8 +726,8 @@ _keybox_dump_file (const char *filename, int stats_only, FILE *outfp) if (rc) fprintf (outfp, "# error reading '%s': %s\n", filename, gpg_strerror (rc)); - if (fp != stdin) - fclose (fp); + if (fp != es_stdin) + es_fclose (fp); if (stats_only) { @@ -787,7 +787,7 @@ cmp_dupitems (const void *arg_a, const void *arg_b) int _keybox_dump_find_dups (const char *filename, int print_them, FILE *outfp) { - FILE *fp; + estream_t fp; KEYBOXBLOB blob; int rc; unsigned long recno = 0; @@ -849,8 +849,8 @@ _keybox_dump_find_dups (const char *filename, int print_them, FILE *outfp) rc = 0; if (rc) fprintf (outfp, "error reading '%s': %s\n", filename, gpg_strerror (rc)); - if (fp != stdin) - fclose (fp); + if (fp != es_stdin) + es_fclose (fp); qsort (dupitems, dupitems_count, sizeof *dupitems, cmp_dupitems); @@ -880,7 +880,7 @@ int _keybox_dump_cut_records (const char *filename, unsigned long from, unsigned long to, FILE *outfp) { - FILE *fp; + estream_t fp; KEYBOXBLOB blob; int rc; unsigned long recno = 0; @@ -894,7 +894,7 @@ _keybox_dump_cut_records (const char *filename, unsigned long from, break; /* Ready. */ if (recno >= from) { - if ((rc = _keybox_write_blob (blob, outfp))) + if ((rc = _keybox_write_blob (blob, NULL, outfp))) { fprintf (stderr, "error writing output: %s\n", gpg_strerror (rc)); @@ -909,7 +909,7 @@ _keybox_dump_cut_records (const char *filename, unsigned long from, if (rc) fprintf (stderr, "error reading '%s': %s\n", filename, gpg_strerror (rc)); leave: - if (fp != stdin) - fclose (fp); + if (fp != es_stdin) + es_fclose (fp); return rc; } |
