1
0
Fork 0
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:
Werner Koch 2020-10-20 11:52:16 +02:00
parent dd5fd4a760
commit 5c6e9b44cc
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
20 changed files with 208 additions and 197 deletions

View file

@ -444,13 +444,13 @@ maybe_create_keyring_or_box (char *filename, int is_box, int force_create)
that the detection magic will work the next time it is used. */
if (is_box)
{
FILE *fp = fopen (filename, "wb");
estream_t fp = es_fopen (filename, "wb");
if (!fp)
rc = gpg_error_from_syserror ();
else
{
rc = _keybox_write_header_blob (fp, 1);
fclose (fp);
es_fclose (fp);
}
if (rc)
{

View file

@ -99,8 +99,8 @@ migrate_secring (ctrl_t ctrl)
log_info ("porting secret keys from '%s' to gpg-agent\n", secring);
if (!import_old_secring (ctrl, secring))
{
FILE *fp = fopen (flagfile, "w");
if (!fp || fclose (fp))
estream_t fp = es_fopen (flagfile, "w");
if (!fp || es_fclose (fp))
log_error ("error creating flag file '%s': %s\n",
flagfile, gpg_strerror (gpg_error_from_syserror ()));
else

View file

@ -725,7 +725,7 @@ tdbio_set_dbname (ctrl_t ctrl, const char *new_dbname,
|| stat (fname, &statbuf)
|| statbuf.st_size == 0)
{
FILE *fp;
estream_t fp;
TRUSTREC rec;
int rc;
mode_t oldmask;
@ -747,11 +747,11 @@ tdbio_set_dbname (ctrl_t ctrl, const char *new_dbname,
gpg_err_set_errno (EPERM);
}
else
fp = fopen (fname, "wb");
fp = es_fopen (fname, "wb");
umask(oldmask);
if (!fp)
log_fatal (_("can't create '%s': %s\n"), fname, strerror (errno));
fclose (fp);
es_fclose (fp);
db_fd = open (db_name, O_RDWR | MY_O_BINARY);
if (db_fd == -1)