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

Function send_request

builtin/credential-cache.c:43–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41#endif
42
43static int send_request(const char *socket, const struct strbuf *out)
44{
45 int got_data = 0;
46 int fd = unix_stream_connect(socket, 0);
47
48 if (fd < 0)
49 return -1;
50
51 if (write_in_full(fd, out->buf, out->len) < 0)
52 die_errno("unable to write to cache daemon");
53 shutdown(fd, SHUT_WR);
54
55 while (1) {
56 char in[1024];
57 int r;
58
59 r = read_in_full(fd, in, sizeof(in));
60 if (r == 0 || (r < 0 && connection_closed(errno)))
61 break;
62 if (r < 0)
63 die_errno("read error from cache daemon");
64 write_or_die(1, in, r);
65 got_data = 1;
66 }
67 close(fd);
68 return got_data;
69}
70
71static void spawn_daemon(const char *socket)
72{

Callers 1

do_cacheFunction · 0.70

Calls 6

unix_stream_connectFunction · 0.85
write_in_fullFunction · 0.85
die_errnoFunction · 0.85
read_in_fullFunction · 0.85
connection_closedFunction · 0.85
write_or_dieFunction · 0.85

Tested by

no test coverage detected