summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-07-23 18:35:59 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-07-23 18:36:00 (GMT)
commit6da748a7cebe3911448fabf9426f81c9df9ec54f (patch)
tree913c572e13be5001f2e78ec6f392ba6f193a795d
parent955d7be808b455cdf2eb60306a690958c3bb49ca (diff)
parent2869b3e5dabdd78b336455ad493951badd35279e (diff)
downloadgit-6da748a7cebe3911448fabf9426f81c9df9ec54f.zip
git-6da748a7cebe3911448fabf9426f81c9df9ec54f.tar.gz
git-6da748a7cebe3911448fabf9426f81c9df9ec54f.tar.bz2
Merge branch 'rs/fix-unlink-unix-socket'
The unix-domain socket used by the sample credential cache daemon tried to unlink an existing stale one at a wrong path, if the path to the socket was given as an overlong path that does not fit in sun_path member of the sockaddr_un structure. * rs/fix-unlink-unix-socket: unix-socket: remove stale socket before calling chdir()
-rw-r--r--unix-socket.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/unix-socket.c b/unix-socket.c
index 01f119f..91bd6b8 100644
--- a/unix-socket.c
+++ b/unix-socket.c
@@ -99,11 +99,12 @@ int unix_stream_listen(const char *path)
struct sockaddr_un sa;
struct unix_sockaddr_context ctx;
+ unlink(path);
+
if (unix_sockaddr_init(&sa, path, &ctx) < 0)
return -1;
fd = unix_stream_socket();
- unlink(path);
if (bind(fd, (struct sockaddr *)&sa, sizeof(sa)) < 0)
goto fail;