[PATCH] keyedit.c: Replace calls to printf by es_printf.

Guilhem Moulin guilhem at fripost.org
Wed Feb 18 21:18:17 CET 2015


Needed for unattended key edits with --status-fd, because since 2.1
status prompts are preceded by es_fflush (in cpr.c:do_get_from_fd) not
fflush(3), so the standard output may not be flushed before each prompt.
(Which breaks scripts using select(2) to multiplex between the standard
and status outputs.)
---
 g10/keyedit.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/g10/keyedit.c b/g10/keyedit.c
index f283e55..db62407 100644
--- a/g10/keyedit.c
+++ b/g10/keyedit.c
@@ -158,22 +158,22 @@ print_and_check_one_sig_colon (KBNODE keyblock, KBNODE node,
 
   if (sigrc != '?' || print_without_key)
     {
-      printf ("sig:%c::%d:%08lX%08lX:%lu:%lu:",
+      es_printf ("sig:%c::%d:%08lX%08lX:%lu:%lu:",
 	      sigrc, sig->pubkey_algo, (ulong) sig->keyid[0],
 	      (ulong) sig->keyid[1], (ulong) sig->timestamp,
 	      (ulong) sig->expiredate);
 
       if (sig->trust_depth || sig->trust_value)
-	printf ("%d %d", sig->trust_depth, sig->trust_value);
+	es_printf ("%d %d", sig->trust_depth, sig->trust_value);
 
-      printf (":");
+      es_printf (":");
 
       if (sig->trust_regexp)
 	es_write_sanitized (es_stdout,
 			    sig->trust_regexp, strlen (sig->trust_regexp),
 			    ":", NULL);
 
-      printf ("::%02x%c\n", sig->sig_class,
+      es_printf ("::%02x%c\n", sig->sig_class,
 	      sig->flags.exportable ? 'x' : 'l');
 
       if (opt.show_subpackets)
@@ -4732,14 +4732,14 @@ ask_revoke_sig (KBNODE keyblock, KBNODE node)
   if (opt.with_colons)
     {
       if (uid->attrib_data)
-	printf ("uat:::::::::%u %lu", uid->numattribs, uid->attrib_len);
+	es_printf ("uat:::::::::%u %lu", uid->numattribs, uid->attrib_len);
       else
 	{
-	  printf ("uid:::::::::");
+	  es_printf ("uid:::::::::");
 	  es_write_sanitized (es_stdout, uid->name, uid->len, ":", NULL);
 	}
 
-      printf ("\n");
+      es_printf ("\n");
 
       print_and_check_one_sig_colon (keyblock, node, NULL, NULL, NULL, NULL,
 				     1);
-- 
2.1.4




More information about the Gnupg-devel mailing list