mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +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
16
sm/keydb.c
16
sm/keydb.c
|
@ -115,7 +115,7 @@ maybe_create_keybox (char *filename, int force, int *r_created)
|
|||
{
|
||||
gpg_err_code_t ec;
|
||||
dotlock_t lockhd = NULL;
|
||||
FILE *fp;
|
||||
estream_t fp;
|
||||
int rc;
|
||||
mode_t oldmask;
|
||||
char *last_slash_in_filename;
|
||||
|
@ -206,7 +206,7 @@ maybe_create_keybox (char *filename, int force, int *r_created)
|
|||
|
||||
/* The file does not yet exist, create it now. */
|
||||
oldmask = umask (077);
|
||||
fp = fopen (filename, "wb");
|
||||
fp = es_fopen (filename, "wb");
|
||||
if (!fp)
|
||||
{
|
||||
rc = gpg_error_from_syserror ();
|
||||
|
@ -223,7 +223,7 @@ maybe_create_keybox (char *filename, int force, int *r_created)
|
|||
rc = _keybox_write_header_blob (fp, 0);
|
||||
if (rc)
|
||||
{
|
||||
fclose (fp);
|
||||
es_fclose (fp);
|
||||
log_error (_("error creating keybox '%s': %s\n"),
|
||||
filename, gpg_strerror (rc));
|
||||
goto leave;
|
||||
|
@ -234,7 +234,7 @@ maybe_create_keybox (char *filename, int force, int *r_created)
|
|||
if (r_created)
|
||||
*r_created = 1;
|
||||
|
||||
fclose (fp);
|
||||
es_fclose (fp);
|
||||
rc = 0;
|
||||
|
||||
leave:
|
||||
|
@ -301,14 +301,15 @@ keydb_add_resource (ctrl_t ctrl, const char *url, int force, int *auto_created)
|
|||
/* see whether we can determine the filetype */
|
||||
if (rt == KEYDB_RESOURCE_TYPE_NONE)
|
||||
{
|
||||
FILE *fp = fopen( filename, "rb" );
|
||||
estream_t fp;
|
||||
|
||||
fp = es_fopen( filename, "rb" );
|
||||
if (fp)
|
||||
{
|
||||
u32 magic;
|
||||
|
||||
/* FIXME: check for the keybox magic */
|
||||
if (fread (&magic, 4, 1, fp) == 1 )
|
||||
if (es_fread (&magic, 4, 1, fp) == 1 )
|
||||
{
|
||||
if (magic == 0x13579ace || magic == 0xce9a5713)
|
||||
; /* GDBM magic - no more support */
|
||||
|
@ -317,7 +318,8 @@ keydb_add_resource (ctrl_t ctrl, const char *url, int force, int *auto_created)
|
|||
}
|
||||
else /* maybe empty: assume keybox */
|
||||
rt = KEYDB_RESOURCE_TYPE_KEYBOX;
|
||||
fclose (fp);
|
||||
|
||||
es_fclose (fp);
|
||||
}
|
||||
else /* no file yet: create keybox */
|
||||
rt = KEYDB_RESOURCE_TYPE_KEYBOX;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue