chiark / gitweb /
dirmngr: Fix error handling.
[gnupg2.git] / g10 / keylist.c
index 4fe1e403427d4e0892fb457e182662aea6502557..407805357f27e90c203c4c659b6604fef4d60993 100644 (file)
@@ -465,6 +465,10 @@ print_signature_stats (struct keylist_context *s)
   if (!s->check_sigs)
     return;  /* Signature checking was not requested.  */
 
+  /* Better flush stdout so that the stats are always printed after
+   * the output.  */
+  es_fflush (es_stdout);
+
   if (s->good_sigs)
     log_info (ngettext("%d good signature\n",
                        "%d good signatures\n", s->good_sigs), s->good_sigs);
@@ -1447,7 +1451,7 @@ list_keyblock_colon (ctrl_t ctrl, kbnode_t keyblock,
            {
              PKT_public_key *signer_pk = NULL;
 
-             fflush (stdout);
+             es_fflush (es_stdout);
              if (opt.no_sig_cache)
                signer_pk = xmalloc_clear (sizeof (PKT_public_key));
 
@@ -1900,6 +1904,9 @@ set_attrib_fd (int fd)
   if (fd == -1)
     return;
 
+  if (! gnupg_fd_valid (fd))
+    log_fatal ("attribute-fd is invalid: %s\n", strerror (errno));
+
 #ifdef HAVE_DOSISH_SYSTEM
   setmode (fd, O_BINARY);
 #endif