projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
git-config-set: add more options
[git.git]
/
daemon.c
diff --git
a/daemon.c
b/daemon.c
index
c3381b3
..
2b81152
100644
(file)
--- a/
daemon.c
+++ b/
daemon.c
@@
-1,5
+1,3
@@
-#include "cache.h"
-#include "pkt-line.h"
#include <signal.h>
#include <sys/wait.h>
#include <sys/socket.h>
#include <signal.h>
#include <sys/wait.h>
#include <sys/socket.h>
@@
-9,6
+7,8
@@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <syslog.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <syslog.h>
+#include "pkt-line.h"
+#include "cache.h"
static int log_syslog;
static int verbose;
static int log_syslog;
static int verbose;
@@
-145,11
+145,11
@@
static int set_dir(const char *dir)
if ( chdir(dir) )
return -1;
if ( chdir(dir) )
return -1;
-
+
/*
* Security on the cheap.
*
/*
* Security on the cheap.
*
- * We want a readable HEAD, usable "objects" directory, and
+ * We want a readable HEAD, usable "objects" directory, and
* a "git-daemon-export-ok" flag that says that the other side
* is ok with us doing this.
*/
* a "git-daemon-export-ok" flag that says that the other side
* is ok with us doing this.
*/
@@
-529,11
+529,11
@@
static int service_loop(int socknum, int *socklist)
}
signal(SIGCHLD, child_handler);
}
signal(SIGCHLD, child_handler);
-
+
for (;;) {
int i;
for (;;) {
int i;
- if (poll(pfd, socknum,
0
) < 0) {
+ if (poll(pfd, socknum,
-1
) < 0) {
if (errno != EINTR) {
error("poll failed, resuming: %s",
strerror(errno));
if (errno != EINTR) {
error("poll failed, resuming: %s",
strerror(errno));
@@
-566,13
+566,13
@@
static int service_loop(int socknum, int *socklist)
static int serve(int port)
{
int socknum, *socklist;
static int serve(int port)
{
int socknum, *socklist;
-
+
socknum = socksetup(port, &socklist);
if (socknum == 0)
die("unable to allocate any listen sockets on port %u", port);
socknum = socksetup(port, &socklist);
if (socknum == 0)
die("unable to allocate any listen sockets on port %u", port);
-
+
return service_loop(socknum, socklist);
return service_loop(socknum, socklist);
-}
+}
int main(int argc, char **argv)
{
int main(int argc, char **argv)
{
@@
-594,6
+594,7
@@
int main(int argc, char **argv)
}
if (!strcmp(arg, "--inetd")) {
inetd_mode = 1;
}
if (!strcmp(arg, "--inetd")) {
inetd_mode = 1;
+ log_syslog = 1;
continue;
}
if (!strcmp(arg, "--verbose")) {
continue;
}
if (!strcmp(arg, "--verbose")) {
@@
-602,7
+603,6
@@
int main(int argc, char **argv)
}
if (!strcmp(arg, "--syslog")) {
log_syslog = 1;
}
if (!strcmp(arg, "--syslog")) {
log_syslog = 1;
- openlog("git-daemon", 0, LOG_DAEMON);
continue;
}
if (!strcmp(arg, "--export-all")) {
continue;
}
if (!strcmp(arg, "--export-all")) {
@@
-611,9
+611,11
@@
int main(int argc, char **argv)
}
if (!strncmp(arg, "--timeout=", 10)) {
timeout = atoi(arg+10);
}
if (!strncmp(arg, "--timeout=", 10)) {
timeout = atoi(arg+10);
+ continue;
}
}
- if (!strncmp(arg, "--init-timeout=", 1
0
)) {
+ if (!strncmp(arg, "--init-timeout=", 1
5
)) {
init_timeout = atoi(arg+15);
init_timeout = atoi(arg+15);
+ continue;
}
if (!strcmp(arg, "--")) {
ok_paths = &argv[i+1];
}
if (!strcmp(arg, "--")) {
ok_paths = &argv[i+1];
@@
-626,10
+628,13
@@
int main(int argc, char **argv)
usage(daemon_usage);
}
usage(daemon_usage);
}
+ if (log_syslog)
+ openlog("git-daemon", 0, LOG_DAEMON);
+
if (inetd_mode) {
fclose(stderr); //FIXME: workaround
return execute();
if (inetd_mode) {
fclose(stderr); //FIXME: workaround
return execute();
- } else {
- return serve(port);
}
}
+
+ return serve(port);
}
}