From 3cf9bb4d73cfe78d3d48734e7c8a65d9a98112a5 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 10 Sep 2020 10:49:54 +0200 Subject: [PATCH] gpg-connect-agent: Catch signals so that SIGPIPE is ignored. * dirmngr/server.c (cmd_killdirmngr): Return 0. * tools/gpg-connect-agent.c (main): Catch signals. -- And we also print nicer diagnostics. The reason we need this is that for example "gpgconf --kill dirmngr" uses gpg-connect-agent to send a command to dirmngr. This may results in a SIGPIPE which in turn leads to an annoying error message from gpgconf. Signed-off-by: Werner Koch --- dirmngr/server.c | 2 +- tools/gpg-connect-agent.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dirmngr/server.c b/dirmngr/server.c index 357aaa592..66ef1c8c9 100644 --- a/dirmngr/server.c +++ b/dirmngr/server.c @@ -2718,7 +2718,7 @@ cmd_killdirmngr (assuan_context_t ctx, char *line) ctrl->server_local->stopme = 1; assuan_set_flag (ctx, ASSUAN_FORCE_CLOSE, 1); - return gpg_error (GPG_ERR_EOF); + return 0; } diff --git a/tools/gpg-connect-agent.c b/tools/gpg-connect-agent.c index ac0bc89dc..6ec08c538 100644 --- a/tools/gpg-connect-agent.c +++ b/tools/gpg-connect-agent.c @@ -1204,6 +1204,7 @@ main (int argc, char **argv) assuan_set_gpg_err_source (0); + gnupg_init_signals (0, NULL); opt.autostart = 1; opt.connect_flags = 1;