daemon.c: fix arg parsing bugs
Allow --init-timeout and --timeout to be specified without falling through to usage(). Make sure openlog() is called even if implied by --inetd, or messages will be sent to wherever LOG_USER ends up. Signed-off-by: Andreas Ericsson <ae@op5.se> Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
fbba222f5d
commit
a8883288fa
8
daemon.c
8
daemon.c
@ -594,6 +594,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
if (!strcmp(arg, "--inetd")) {
|
if (!strcmp(arg, "--inetd")) {
|
||||||
inetd_mode = 1;
|
inetd_mode = 1;
|
||||||
|
log_syslog = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!strcmp(arg, "--verbose")) {
|
if (!strcmp(arg, "--verbose")) {
|
||||||
@ -602,7 +603,6 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
if (!strcmp(arg, "--syslog")) {
|
if (!strcmp(arg, "--syslog")) {
|
||||||
log_syslog = 1;
|
log_syslog = 1;
|
||||||
openlog("git-daemon", 0, LOG_DAEMON);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!strcmp(arg, "--export-all")) {
|
if (!strcmp(arg, "--export-all")) {
|
||||||
@ -611,9 +611,11 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
if (!strncmp(arg, "--timeout=", 10)) {
|
if (!strncmp(arg, "--timeout=", 10)) {
|
||||||
timeout = atoi(arg+10);
|
timeout = atoi(arg+10);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
if (!strncmp(arg, "--init-timeout=", 15)) {
|
if (!strncmp(arg, "--init-timeout=", 15)) {
|
||||||
init_timeout = atoi(arg+15);
|
init_timeout = atoi(arg+15);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
if (!strcmp(arg, "--")) {
|
if (!strcmp(arg, "--")) {
|
||||||
ok_paths = &argv[i+1];
|
ok_paths = &argv[i+1];
|
||||||
@ -626,9 +628,11 @@ int main(int argc, char **argv)
|
|||||||
usage(daemon_usage);
|
usage(daemon_usage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (log_syslog)
|
||||||
|
openlog("git-daemon", 0, LOG_DAEMON);
|
||||||
|
|
||||||
if (inetd_mode) {
|
if (inetd_mode) {
|
||||||
fclose(stderr); //FIXME: workaround
|
fclose(stderr); //FIXME: workaround
|
||||||
log_syslog = 1;
|
|
||||||
return execute();
|
return execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user