Merge branch 'dl/credential-cache-socket-in-xdg-cache' into maint
authorJunio C Hamano <gitster@pobox.com>
Wed, 23 Aug 2017 21:33:45 +0000 (14:33 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 23 Aug 2017 21:33:45 +0000 (14:33 -0700)
A recently added test for the "credential-cache" helper revealed
that EOF detection done around the time the connection to the cache
daemon is torn down were flaky. This was fixed by reacting to
ECONNRESET and behaving as if we got an EOF.

* dl/credential-cache-socket-in-xdg-cache:
credential-cache: interpret an ECONNRESET as an EOF

1  2 
credential-cache.c
diff --combined credential-cache.c
index 91550bfb0b3325ad92a3f3c65d5f779b61fa9951,3c13fe4d6aeda373b46dbe87ebbab224c70501a9..1cccc3a0b9cfb2a14e9c87d5afc29234fa62adc4
@@@ -25,7 -25,7 +25,7 @@@ static int send_request(const char *soc
                int r;
  
                r = read_in_full(fd, in, sizeof(in));
-               if (r == 0)
+               if (r == 0 || (r < 0 && errno == ECONNRESET))
                        break;
                if (r < 0)
                        die_errno("read error from cache daemon");
@@@ -87,7 -87,7 +87,7 @@@ static char *get_socket_path(void
  {
        struct stat sb;
        char *old_dir, *socket;
 -      old_dir = expand_user_path("~/.git-credential-cache");
 +      old_dir = expand_user_path("~/.git-credential-cache", 0);
        if (old_dir && !stat(old_dir, &sb) && S_ISDIR(sb.st_mode))
                socket = xstrfmt("%s/socket", old_dir);
        else