{"thread":{"id":"5265","subject":"[PATCH 16/28] daemon.c cleanup","startedAt":"2006-08-14T20:32:43Z","lastAt":"2006-08-14T20:32:43Z","messageCount":1,"participants":["David Rientjes"],"isPatch":true,"patchVersion":1,"patchTotal":28},"messages":[{"id":"25296","messageId":"Pine.LNX.4.63.0608141332020.19383@chino.corp.google.com","threadId":"5265","inReplyTo":null,"subject":"[PATCH 16/28] daemon.c cleanup","fromName":"David Rientjes","fromEmail":"rientjes@google.com","sentAt":"2006-08-14T20:32:43Z","receivedAt":"2006-08-14T20:32:43Z","isPatch":true,"sender":{"key":"rientjes@google.com","avatar":null},"body":"Makes execute and upload void and cleans up function calls.\n\n\t\tDavid\n\nSigned-off-by: David Rientjes <rientjes@google.com>\n---\n daemon.c |   25 +++++++++++++------------\n 1 files changed, 13 insertions(+), 12 deletions(-)\n\ndiff --git a/daemon.c b/daemon.c\nindex 810837f..53ef514 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -229,7 +229,7 @@ static char *path_ok(char *dir)\n \treturn NULL;\t\t/* Fallthrough. Deny by default */\n }\n \n-static int upload(char *dir)\n+static void upload(char *dir)\n {\n \t/* Timeout as string */\n \tchar timeout_buf[64];\n@@ -238,7 +238,7 @@ static int upload(char *dir)\n \tloginfo(\"Request for '%s'\", dir);\n \n \tif (!(path = path_ok(dir)))\n-\t\treturn -1;\n+\t\treturn;\n \n \t/*\n \t * Security on the cheap.\n@@ -254,7 +254,7 @@ static int upload(char *dir)\n \tif (!export_all_trees && access(\"git-daemon-export-ok\", F_OK)) {\n \t\tlogerror(\"'%s': repository not exported.\", path);\n \t\terrno = EACCES;\n-\t\treturn -1;\n+\t\treturn;\n \t}\n \n \t/*\n@@ -267,10 +267,9 @@ static int upload(char *dir)\n \n \t/* git-upload-pack only ever reads stuff, so this is safe */\n \texecl_git_cmd(\"upload-pack\", \"--strict\", timeout_buf, \".\", NULL);\n-\treturn -1;\n }\n \n-static int execute(struct sockaddr *addr)\n+static void execute(struct sockaddr *addr)\n {\n \tstatic char line[1000];\n \tint pktlen, len;\n@@ -310,11 +309,11 @@ #endif\n \tif (len && line[len-1] == '\\n')\n \t\tline[--len] = 0;\n \n-\tif (!strncmp(\"git-upload-pack \", line, 16))\n-\t\treturn upload(line+16);\n-\n-\tlogerror(\"Protocol error: '%s'\", line);\n-\treturn -1;\n+\tif (!strncmp(\"git-upload-pack \", line, 16)) {\n+\t\tupload(line+16);\n+\t} else {\n+\t\tlogerror(\"Protocol error: '%s'\", line);\n+\t}\n }\n \n \n@@ -463,7 +462,8 @@ static void handle(int incoming, struct \n \tdup2(incoming, 1);\n \tclose(incoming);\n \n-\texit(execute(addr));\n+\texecute(addr);\n+\texit(-1);\n }\n \n static void child_handler(int signo)\n@@ -820,7 +820,8 @@ int main(int argc, char **argv)\n \t\tif (getpeername(0, peer, &slen))\n \t\t\tpeer = NULL;\n \n-\t\treturn execute(peer);\n+\t\texecute(peer);\n+\t\treturn -1;\n \t}\n \n \tif (detach)\n-- \n1.4.2.g89bb-dirty\n"}]}