X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=reposerve;a=blobdiff_plain;f=server%2Fsrc%2Fmain.c;h=ab5c05568dbf19017b0974e8b9583c7ae9ac654b;hp=12bb01f087f564986e64aff3bf7fafeddb4b0ac8;hb=779888af6bc05f2395e0c9fc0c53067e0674cb27;hpb=fdbff4437ad74ce1457051d2f743e50672be1ec4 diff --git a/server/src/main.c b/server/src/main.c index 12bb01f..ab5c055 100644 --- a/server/src/main.c +++ b/server/src/main.c @@ -15,12 +15,15 @@ static const char *guess_repo_name(const char *path); static int parse_args(int argc, char **argv); -static const char *repo_path, *repo_name; +static const char *repo_name; static int lis = -1; static int port = 64357; static struct client *clients; +const char *repo_path; + + int main(int argc, char **argv) { struct sockaddr_in addr; @@ -101,7 +104,7 @@ int main(int argc, char **argv) perror("failed to accept connection"); continue; } - if(!(c = malloc(sizeof *c))) { + if(!(c = calloc(1, sizeof *c))) { perror("failed to allocate memory for client structure"); close(s); continue; @@ -109,6 +112,8 @@ int main(int argc, char **argv) c->s = s; c->next = clients; clients = c; + + send_string(c, "reposerve-0.1 protocol:0\n"); } }