Skip to content

Commit

Permalink
credential-cache--daemon: delete socket from main()
Browse files Browse the repository at this point in the history
main() is responsible for cleaning up the socket in the case of
errors, so it is reasonable to also make it responsible for cleaning
it up when there are no errors. This change also makes the next step
easier.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
mhagger authored and gitster committed Aug 12, 2015
1 parent ebebeae commit 18a3de4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion credential-cache--daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ static void serve_cache(const char *socket_path, int debug)
; /* nothing */

close(fd);
unlink(socket_path);
}

static const char permissions_advice[] =
Expand Down Expand Up @@ -280,5 +279,7 @@ int main(int argc, const char **argv)

serve_cache(socket_path, debug);

unlink(socket_path);

return 0;
}

0 comments on commit 18a3de4

Please sign in to comment.