[Pkg-gnupg-commit] [gnupg2] 144/159: gpg: Print PROGRESS status lines during key generation.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed Jan 27 13:24:03 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gnupg2.

commit fbe1cf67aadc5a33cf815ddbcfc9669e43caa123
Author: Werner Koch <wk at gnupg.org>
Date:   Mon Jan 25 11:34:49 2016 +0100

    gpg: Print PROGRESS status lines during key generation.
    
    * g10/call-agent.c (cache_nonce_status_cb): Rewrite by using
    has_leading_keyword.  Handle PROGRESS lines.
    --
    
    GnuPG-bug-id: 1415
    Co-authored-by: Daiki Ueno <ueno at gnu.org>
    Signed-off-by: Werner Koch <wk at gnupg.org>
---
 g10/call-agent.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/g10/call-agent.c b/g10/call-agent.c
index 83fabcc..1d7ff57 100644
--- a/g10/call-agent.c
+++ b/g10/call-agent.c
@@ -1749,30 +1749,29 @@ static gpg_error_t
 cache_nonce_status_cb (void *opaque, const char *line)
 {
   struct cache_nonce_parm_s *parm = opaque;
-  const char *keyword = line;
-  int keywordlen;
-
-  for (keywordlen=0; *line && !spacep (line); line++, keywordlen++)
-    ;
-  while (spacep (line))
-    line++;
+  const char *s;
 
-  if (keywordlen == 11 && !memcmp (keyword, "CACHE_NONCE", keywordlen))
+  if ((s = has_leading_keyword (line, "CACHE_NONCE")))
     {
       if (parm->cache_nonce_addr)
         {
           xfree (*parm->cache_nonce_addr);
-          *parm->cache_nonce_addr = xtrystrdup (line);
+          *parm->cache_nonce_addr = xtrystrdup (s);
         }
     }
-  else if (keywordlen == 12 && !memcmp (keyword, "PASSWD_NONCE", keywordlen))
+  else if ((s = has_leading_keyword (line, "PASSWD_NONCE")))
     {
       if (parm->passwd_nonce_addr)
         {
           xfree (*parm->passwd_nonce_addr);
-          *parm->passwd_nonce_addr = xtrystrdup (line);
+          *parm->passwd_nonce_addr = xtrystrdup (s);
         }
     }
+  else if ((s = has_leading_keyword (line, "PROGRESS")))
+    {
+      if (opt.enable_progress_filter)
+        write_status_text (STATUS_PROGRESS, s);
+    }
 
   return 0;
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list