* [PATCH 16/28] daemon.c cleanup
@ 2006-08-14 20:32 David Rientjes
0 siblings, 0 replies; only message in thread
From: David Rientjes @ 2006-08-14 20:32 UTC (permalink / raw)
To: git
Makes execute and upload void and cleans up function calls.
David
Signed-off-by: David Rientjes <rientjes@google.com>
---
daemon.c | 25 +++++++++++++------------
1 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/daemon.c b/daemon.c
index 810837f..53ef514 100644
--- a/daemon.c
+++ b/daemon.c
@@ -229,7 +229,7 @@ static char *path_ok(char *dir)
return NULL; /* Fallthrough. Deny by default */
}
-static int upload(char *dir)
+static void upload(char *dir)
{
/* Timeout as string */
char timeout_buf[64];
@@ -238,7 +238,7 @@ static int upload(char *dir)
loginfo("Request for '%s'", dir);
if (!(path = path_ok(dir)))
- return -1;
+ return;
/*
* Security on the cheap.
@@ -254,7 +254,7 @@ static int upload(char *dir)
if (!export_all_trees && access("git-daemon-export-ok", F_OK)) {
logerror("'%s': repository not exported.", path);
errno = EACCES;
- return -1;
+ return;
}
/*
@@ -267,10 +267,9 @@ static int upload(char *dir)
/* git-upload-pack only ever reads stuff, so this is safe */
execl_git_cmd("upload-pack", "--strict", timeout_buf, ".", NULL);
- return -1;
}
-static int execute(struct sockaddr *addr)
+static void execute(struct sockaddr *addr)
{
static char line[1000];
int pktlen, len;
@@ -310,11 +309,11 @@ #endif
if (len && line[len-1] == '\n')
line[--len] = 0;
- if (!strncmp("git-upload-pack ", line, 16))
- return upload(line+16);
-
- logerror("Protocol error: '%s'", line);
- return -1;
+ if (!strncmp("git-upload-pack ", line, 16)) {
+ upload(line+16);
+ } else {
+ logerror("Protocol error: '%s'", line);
+ }
}
@@ -463,7 +462,8 @@ static void handle(int incoming, struct
dup2(incoming, 1);
close(incoming);
- exit(execute(addr));
+ execute(addr);
+ exit(-1);
}
static void child_handler(int signo)
@@ -820,7 +820,8 @@ int main(int argc, char **argv)
if (getpeername(0, peer, &slen))
peer = NULL;
- return execute(peer);
+ execute(peer);
+ return -1;
}
if (detach)
--
1.4.2.g89bb-dirty
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2006-08-14 20:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-14 20:32 [PATCH 16/28] daemon.c cleanup David Rientjes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).