]> git.ipfire.org Git - thirdparty/git.git/commitdiff
credential-cache--daemon: delete socket from main()
authorMichael Haggerty <mhagger@alum.mit.edu>
Mon, 10 Aug 2015 09:47:50 +0000 (11:47 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 12 Aug 2015 21:50:11 +0000 (14:50 -0700)
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>
credential-cache--daemon.c

index c2f00498f6a171ecde3dd91a5cbdb30d88827495..a671b2b53cbc343174802ba5145cc7310555706d 100644 (file)
@@ -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[] =
@@ -280,5 +279,7 @@ int main(int argc, const char **argv)
 
        serve_cache(socket_path, debug);
 
+       unlink(socket_path);
+
        return 0;
 }