MCPcopy Create free account
hub / github.com/git/git / unix_stream_connect

Function unix_stream_connect

unix-socket.c:80–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80int unix_stream_connect(const char *path, int disallow_chdir)
81{
82 int fd = -1, saved_errno;
83 struct sockaddr_un sa;
84 struct unix_sockaddr_context ctx;
85
86 if (unix_sockaddr_init(&sa, path, &ctx, disallow_chdir) < 0)
87 return -1;
88 fd = socket(AF_UNIX, SOCK_STREAM, 0);
89 if (fd < 0)
90 goto fail;
91
92 if (connect(fd, (struct sockaddr *)&sa, sizeof(sa)) < 0)
93 goto fail;
94 unix_sockaddr_cleanup(&ctx);
95 return fd;
96
97fail:
98 saved_errno = errno;
99 if (fd != -1)
100 close(fd);
101 unix_sockaddr_cleanup(&ctx);
102 errno = saved_errno;
103 return -1;
104}
105
106int unix_stream_listen(const char *path,
107 const struct unix_stream_listen_opts *opts)

Callers 3

is_another_server_aliveFunction · 0.85
connect_to_serverFunction · 0.85
send_requestFunction · 0.85

Calls 2

unix_sockaddr_initFunction · 0.85
unix_sockaddr_cleanupFunction · 0.85

Tested by

no test coverage detected