summaryrefslogtreecommitdiff
path: root/credential-cache--daemon.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-04-14 18:37:16 -0700
committerJunio C Hamano <gitster@pobox.com>2016-04-14 18:37:16 -0700
commit485c7ade03c219e1b6003d566b6d0eae7bd44e1b (patch)
treed8c3735aa231a0a937d463f35fa1ed2d1fed2fad /credential-cache--daemon.c
parent1d1cbe224f280be2a270274a4e843ceccbe1a030 (diff)
parent7d5e9c9849a809ff70223037bf6d569a8e2d3e66 (diff)
downloadgit-485c7ade03c219e1b6003d566b6d0eae7bd44e1b.tar.gz
Merge branch 'jk/credential-cache-comment-exit' into maint
A code clarification. * jk/credential-cache-comment-exit: credential-cache--daemon: clarify "exit" action semantics
Diffstat (limited to 'credential-cache--daemon.c')
-rw-r--r--credential-cache--daemon.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/credential-cache--daemon.c b/credential-cache--daemon.c
index caef21e4fc..291c0fd5e9 100644
--- a/credential-cache--daemon.c
+++ b/credential-cache--daemon.c
@@ -126,8 +126,17 @@ static void serve_one_client(FILE *in, FILE *out)
fprintf(out, "password=%s\n", e->item.password);
}
}
- else if (!strcmp(action.buf, "exit"))
+ else if (!strcmp(action.buf, "exit")) {
+ /*
+ * It's important that we clean up our socket first, and then
+ * signal the client only once we have finished the cleanup.
+ * Calling exit() directly does this, because we clean up in
+ * our atexit() handler, and then signal the client when our
+ * process actually ends, which closes the socket and gives
+ * them EOF.
+ */
exit(0);
+ }
else if (!strcmp(action.buf, "erase"))
remove_credential(&c);
else if (!strcmp(action.buf, "store")) {