summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e68b6f1)
raw | patch | inline | side by side (parent: e68b6f1)
author | Linus Torvalds <torvalds@g5.osdl.org> | |
Fri, 15 Jul 2005 16:27:05 +0000 (09:27 -0700) | ||
committer | Linus Torvalds <torvalds@g5.osdl.org> | |
Fri, 15 Jul 2005 16:27:05 +0000 (09:27 -0700) |
Alexey Nezhdanov sent a patch that made git-daemon usable from inetd (ie
where inetd has already done the accept on the new connection, the fork,
and the setup of stdin/stdout). I wanted to organize the thing slightly
differently, though.
where inetd has already done the accept on the new connection, the fork,
and the setup of stdin/stdout). I wanted to organize the thing slightly
differently, though.
daemon.c | patch | blob | history |
diff --git a/daemon.c b/daemon.c
index 315a74bf108dc648fd9b86b40a4257fe27df907e..c5a46b73f00cd467c7d867bbad6d2308a27c2fc6 100644 (file)
--- a/daemon.c
+++ b/daemon.c
return -1;
}
-static int execute(char *line, int len)
+static int execute(void)
{
+ static char line[1000];
+ int len;
+
+ len = packet_read_line(0, line, sizeof(line));
+
+ if (len && line[len-1] == '\n')
+ line[--len] = 0;
+
if (!strncmp("git-upload-pack /", line, 17))
return upload(line + 16, len - 16);
static void handle(int incoming, struct sockaddr_in *addr, int addrlen)
{
- static char line[1000];
- int len;
-
if (fork()) {
close(incoming);
return;
dup2(incoming, 0);
dup2(incoming, 1);
close(incoming);
- len = packet_read_line(0, line, sizeof(line));
-
- if (len && line[len-1] == '\n')
- line[--len] = 0;
-
- exit(execute(line, len));
+ exit(execute());
}
static int serve(int port)