credentials: unable to connect to cache daemon

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> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Clemens Buchacher committed Jan 7, 2012 at 12:54 UTC 98c2924cfa84a7f30b17636bd5632e53a0fa002e
1 file changed +3 -4
credential-cache.c
+3 -4
@@ -71,11 +71,10 @@ static void do_cache(const char *socket, const char *action, int timeout,
71 die_errno("unable to relay credential");
72 }
73
74 - if (!send_request(socket, &buf))
75 - return;
76 - if (flags & FLAG_SPAWN) {
74 + if (send_request(socket, &buf) < 0 && (flags & FLAG_SPAWN)) {
75 spawn_daemon(socket);
78 - send_request(socket, &buf);
76 + if (send_request(socket, &buf) < 0)
77 + die_errno("unable to connect to cache daemon");
78 }
79 strbuf_release(&buf);
80 }