aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoritz Schulte <[email protected]>2004-10-02 10:42:17 +0000
committerMoritz Schulte <[email protected]>2004-10-02 10:42:17 +0000
commit4c7ac53ed3a7f54ddd4071736a983b7c4ceb884e (patch)
tree5f976c90f88f99dbf3864a29fa33a57bf6b67e93
parentUpdated from Libestream. (diff)
downloadgnupg-4c7ac53ed3a7f54ddd4071736a983b7c4ceb884e.tar.gz
gnupg-4c7ac53ed3a7f54ddd4071736a983b7c4ceb884e.zip
Cleaned up comment handling.
-rw-r--r--agent/findkey.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/agent/findkey.c b/agent/findkey.c
index 58c4d26b6..b36c2df7e 100644
--- a/agent/findkey.c
+++ b/agent/findkey.c
@@ -385,18 +385,6 @@ agent_key_from_file (CTRL ctrl, const char *desc_text,
return rc;
}
- comment_sexp = gcry_sexp_find_token (s_skey, "comment", 0);
- if (comment_sexp)
- {
- comment = gcry_sexp_nth_data (comment_sexp, 1, &comment_length);
- if (! comment)
- {
- rc = GPG_ERR_INV_SEXP;
- gcry_sexp_release (s_skey);
- return rc;
- }
- }
-
len = gcry_sexp_sprint (s_skey, GCRYSEXP_FMT_CANON, NULL, 0);
assert (len);
buf = xtrymalloc (len);
@@ -415,8 +403,13 @@ agent_key_from_file (CTRL ctrl, const char *desc_text,
case PRIVATE_KEY_CLEAR:
break; /* no unprotection needed */
case PRIVATE_KEY_PROTECTED:
+ comment_sexp = gcry_sexp_find_token (s_skey, "comment", 0);
+ if (comment_sexp)
+ comment = gcry_sexp_nth_data (comment_sexp, 1, &comment_length);
+
rc = modify_description (desc_text,
comment, comment_length, &desc_text_modified);
+ gcry_sexp_release (comment_sexp);
if (rc)
log_error ("failed to modify description: %s\n", gpg_strerror (rc));
else