From 99d2931887e5ba0db9007024b3420b110603d5be Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Thu, 23 Jun 2022 11:05:51 +0900 Subject: [PATCH] agent: Flush before calling ftruncate. * agent/findkey.c (write_extended_private_key): Make sure it is flushed out. -- GnuPG-bug-id: 6035 Signed-off-by: NIIBE Yutaka --- agent/findkey.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/agent/findkey.c b/agent/findkey.c index 8c128ce00..b0a941078 100644 --- a/agent/findkey.c +++ b/agent/findkey.c @@ -172,6 +172,8 @@ write_extended_private_key (char *fname, estream_t fp, int update, int newkey, goto leave; err = nvc_write (pk, fp); + if (!err) + err = es_fflush (fp); if (err) { log_error ("error writing '%s': %s\n", fname, gpg_strerror (err));