1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-08 12:44:23 +01:00

agent: Fix printed error in findkey.

* agent/findkey.c (agent_write_private_key): Fix error reporting.
This commit is contained in:
Werner Koch 2023-05-26 14:19:27 +02:00
parent fe881167c5
commit 7cf8c5c291
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -237,13 +237,14 @@ agent_write_private_key (const unsigned char *grip,
fp = fname ? es_fopen (fname, "wbx,mode=-rw") : NULL; fp = fname ? es_fopen (fname, "wbx,mode=-rw") : NULL;
if (!fp) if (!fp)
{ {
err = gpg_error_from_syserror ();
log_error ("can't create '%s': %s\n", fname, gpg_strerror (err)); log_error ("can't create '%s': %s\n", fname, gpg_strerror (err));
goto leave; goto leave;
} }
err = nvc_write (pk, fp); err = nvc_write (pk, fp);
if (!err) if (!err && es_fflush (fp))
err = es_fflush (fp); err = gpg_error_from_syserror ();
if (err) if (err)
{ {
log_error ("error writing '%s': %s\n", fname, gpg_strerror (err)); log_error ("error writing '%s': %s\n", fname, gpg_strerror (err));