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 /sm/qualified.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 'sm/qualified.c')
-rw-r--r-- | sm/qualified.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sm/qualified.c b/sm/qualified.c index a1d6fe9bf..4d8dfccab 100644 --- a/sm/qualified.c +++ b/sm/qualified.c @@ -34,7 +34,7 @@ NULL indicates that this module has been initialized and if the LISTFP is also NULL, no list of qualified signatures exists. */ static char *listname; -static FILE *listfp; +static estream_t listfp; /* Read the trustlist and return entry by entry. KEY must point to a @@ -58,7 +58,7 @@ read_list (char *key, char *country, int *lnr) if (!listname) { listname = make_filename (gnupg_sysconfdir (), "qualified.txt", NULL); - listfp = fopen (listname, "r"); + listfp = es_fopen (listname, "r"); if (!listfp && errno != ENOENT) { err = gpg_error_from_syserror (); @@ -72,9 +72,9 @@ read_list (char *key, char *country, int *lnr) do { - if (!fgets (line, DIM(line)-1, listfp) ) + if (!es_fgets (line, DIM(line)-1, listfp) ) { - if (feof (listfp)) + if (es_feof (listfp)) return gpg_error (GPG_ERR_EOF); return gpg_error_from_syserror (); } @@ -82,7 +82,7 @@ read_list (char *key, char *country, int *lnr) if (!*line || line[strlen(line)-1] != '\n') { /* Eat until end of line. */ - while ( (c=getc (listfp)) != EOF && c != '\n') + while ((c = es_getc (listfp)) != EOF && c != '\n') ; return gpg_error (*line? GPG_ERR_LINE_TOO_LONG : GPG_ERR_INCOMPLETE_LINE); @@ -162,8 +162,8 @@ gpgsm_is_in_qualified_list (ctrl_t ctrl, ksba_cert_t cert, char *country) if (listfp) { /* W32ce has no rewind, thus we use the equivalent code. */ - fseek (listfp, 0, SEEK_SET); - clearerr (listfp); + es_fseek (listfp, 0, SEEK_SET); + es_clearerr (listfp); } while (!(err = read_list (key, mycountry, &lnr))) { |