From ef4f22b9d98b4021796a607fb98016ef62c4c559 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Thu, 1 Jun 2023 11:58:53 +0900 Subject: [PATCH] gpg: Graceful exit for signature checking with --batch. * g10/mainproc.c (check_sig_and_print): Don't abort computation in the function, but returns an error. (proc_tree): Break the loop, when check_sig_and_print returns an error. -- GnuPG-bug-id: 6512 Signed-off-by: NIIBE Yutaka --- g10/mainproc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/g10/mainproc.c b/g10/mainproc.c index ce0fdaaac..7dea49728 100644 --- a/g10/mainproc.c +++ b/g10/mainproc.c @@ -2542,8 +2542,6 @@ check_sig_and_print (CTX c, kbnode_t node) release_kbnode( keyblock ); if (rc) g10_errors_seen = 1; - if (opt.batch && rc) - g10_exit (1); } else /* Error checking the signature. (neither Good nor Bad). */ { @@ -2660,7 +2658,8 @@ proc_tree (CTX c, kbnode_t node) } for (n1 = node; (n1 = find_next_kbnode (n1, PKT_SIGNATURE));) - check_sig_and_print (c, n1); + if (check_sig_and_print (c, n1) && opt.batch) + break; } else if (node->pkt->pkttype == PKT_GPG_CONTROL @@ -2679,8 +2678,8 @@ proc_tree (CTX c, kbnode_t node) } for (n1 = node; (n1 = find_next_kbnode (n1, PKT_SIGNATURE));) - check_sig_and_print (c, n1); - + if (check_sig_and_print (c, n1) && opt.batch) + break; } else if (node->pkt->pkttype == PKT_SIGNATURE) { @@ -2807,7 +2806,8 @@ proc_tree (CTX c, kbnode_t node) if (multiple_ok) { for (n1 = node; n1; (n1 = find_next_kbnode(n1, PKT_SIGNATURE))) - check_sig_and_print (c, n1); + if (check_sig_and_print (c, n1) && opt.batch) + break; } else check_sig_and_print (c, node);