summaryrefslogtreecommitdiffstats
path: root/common/helpfile.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2020-10-20 11:52:16 +0200
committerWerner Koch <wk@gnupg.org>2020-10-20 12:15:56 +0200
commit390497ea115e1aca93feec297a5bd6ae7b1ba6dd (patch)
tree675448ff809e3f333bba4918e4787eacda7f8190 /common/helpfile.c
parentReplace all calls to access by gnupg_access (diff)
downloadgnupg2-390497ea115e1aca93feec297a5bd6ae7b1ba6dd.tar.xz
gnupg2-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 <wk@gnupg.org>
Diffstat (limited to 'common/helpfile.c')
-rw-r--r--common/helpfile.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/common/helpfile.c b/common/helpfile.c
index 7cb01a443..7a7a2358a 100644
--- a/common/helpfile.c
+++ b/common/helpfile.c
@@ -41,14 +41,14 @@ static char *
findkey_fname (const char *key, const char *fname)
{
gpg_error_t err = 0;
- FILE *fp;
+ estream_t fp;
int lnr = 0;
int c;
char *p, line[256];
int in_item = 0;
membuf_t mb = MEMBUF_ZERO;
- fp = fopen (fname, "r");
+ fp = es_fopen (fname, "r");
if (!fp)
{
if (errno != ENOENT)
@@ -59,14 +59,14 @@ findkey_fname (const char *key, const char *fname)
return NULL;
}
- while (fgets (line, DIM(line)-1, fp))
+ while (es_fgets (line, DIM(line)-1, fp))
{
lnr++;
if (!*line || line[strlen(line)-1] != '\n')
{
/* Eat until end of line. */
- while ( (c=getc (fp)) != EOF && c != '\n')
+ while ((c = es_getc (fp)) != EOF && c != '\n')
;
err = gpg_error (*line? GPG_ERR_LINE_TOO_LONG
: GPG_ERR_INCOMPLETE_LINE);
@@ -130,14 +130,14 @@ findkey_fname (const char *key, const char *fname)
}
}
- if ( !err && ferror (fp) )
+ if ( !err && es_ferror (fp) )
{
err = gpg_error_from_syserror ();
log_error (_("error reading '%s', line %d: %s\n"),
fname, lnr, gpg_strerror (err));
}
- fclose (fp);
+ es_fclose (fp);
if (is_membuf_ready (&mb))
{
/* We have collected something. */