mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
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>
Backported-from-master: 390497ea11
This commit is contained in:
parent
dd5fd4a760
commit
5c6e9b44cc
20 changed files with 208 additions and 197 deletions
|
@ -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. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue