[PATCH] credentials: unable to connect to cache daemon
- From
Clemens Buchacher <drizzd@aon.at>
- Date
- Jan 7, 2012, 11:54 UTC
- Message-ID
- <20120107115434.GA8568@ecki.lan>
- In-Reply-To
- <20120106223215.GA13106@sigill.intra.peff.net>
Error out if we just spawned the daemon and yet we cannot connect.
And always release the string buffer.
Signed-off-by: Clemens Buchacher <drizzd@aon.at> ---
Hi Jeff,
I wrote this while debugging why t0301-credential-cache.sh failed after I enabled cleanup_children by default. This error condition turned out not to be the problem, and this patch would not have helped in debugging this case. But I think it makes sense anyways.
credential-cache.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/credential-cache.c b/credential-cache.c index dc98372..8f25c06 100644 --- a/credential-cache.c +++ b/credential-cache.c @@ -71,11 +71,10 @@ static void do_cache(const char *socket, const char *action, int timeout, die_errno("unable to relay credential"); } - if (!send_request(socket, &buf)) - return; - if (flags & FLAG_SPAWN) { + if (send_request(socket, &buf) < 0 && flags & FLAG_SPAWN) { spawn_daemon(socket); - send_request(socket, &buf); + if (send_request(socket, &buf) < 0) + die_errno("unable to connect to cache daemon"); } strbuf_release(&buf); }
-- 1.7.8