From 2d4e157d85e68d1c9a0cd44e8f69acb955a8df30 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Mon, 16 Jul 2007 14:33:34 +0000 Subject: [PATCH] 2007-07-16 Marcus Brinkmann * gpg-connect-agent.c (main): Bail out if write fails. --- tools/ChangeLog | 4 ++++ tools/gpg-connect-agent.c | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/ChangeLog b/tools/ChangeLog index 9ddd3aa05..2afcf51b7 100644 --- a/tools/ChangeLog +++ b/tools/ChangeLog @@ -1,3 +1,7 @@ +2007-07-16 Marcus Brinkmann + + * gpg-connect-agent.c (main): Bail out if write fails. + 2007-07-05 Marcus Brinkmann * symcryptrun.c (confucius_get_pass): Define orig_codeset if diff --git a/tools/gpg-connect-agent.c b/tools/gpg-connect-agent.c index a07a7b67d..5322a4fc5 100644 --- a/tools/gpg-connect-agent.c +++ b/tools/gpg-connect-agent.c @@ -258,7 +258,6 @@ do_recvfd (assuan_context_t ctx, char *line) } - /* gpg-connect-agent's entry point. */ int main (int argc, char **argv) @@ -464,7 +463,7 @@ main (int argc, char **argv) if (rc) { log_info (_("sending line failed: %s\n"), gpg_strerror (rc) ); - continue; + break; } if (*line == '#' || !*line) continue; /* Don't expect a response for a comment line. */ @@ -472,6 +471,12 @@ main (int argc, char **argv) rc = read_and_print_response (ctx); if (rc) log_info (_("receiving line failed: %s\n"), gpg_strerror (rc) ); + + /* FIXME: If the last command was BYE or the server died for + some other reason, we won't notice until we get the next + input command. Probing the connection with a non-blocking + read could help to notice termination or other problems + early. */ } if (opt.verbose)