Git development
 help / color / mirror / Atom feed
From: exon@op5.se (Andreas Ericsson)
To: git@vger.kernel.org
Subject: [PATCH] daemon.c: fix arg parsing bugs
Date: Thu, 17 Nov 2005 00:38:29 +0100 (CET)	[thread overview]
Message-ID: <20051116233829.071CC5BF78@nox.op5.se> (raw)


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>

---

 daemon.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

applies-to: 1e3fcf60526c196a46433e6947c9104ca236f230
83a3edea8623834fd7827f80cad2af4927f5a19e
diff --git a/daemon.c b/daemon.c
index e184752..2b81152 100644
--- a/daemon.c
+++ b/daemon.c
@@ -594,6 +594,7 @@ int main(int argc, char **argv)
 		}
 		if (!strcmp(arg, "--inetd")) {
 			inetd_mode = 1;
+			log_syslog = 1;
 			continue;
 		}
 		if (!strcmp(arg, "--verbose")) {
@@ -602,7 +603,6 @@ int main(int argc, char **argv)
 		}
 		if (!strcmp(arg, "--syslog")) {
 			log_syslog = 1;
-			openlog("git-daemon", 0, LOG_DAEMON);
 			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);
+			continue;
 		}
 		if (!strncmp(arg, "--init-timeout=", 15)) {
 			init_timeout = atoi(arg+15);
+			continue;
 		}
 		if (!strcmp(arg, "--")) {
 			ok_paths = &argv[i+1];
@@ -626,9 +628,11 @@ int main(int argc, char **argv)
 		usage(daemon_usage);
 	}
 
+	if (log_syslog)
+		openlog("git-daemon", 0, LOG_DAEMON);
+
 	if (inetd_mode) {
 		fclose(stderr); //FIXME: workaround
-		log_syslog = 1;
 		return execute();
 	}
 
---
0.99.9.GIT

                 reply	other threads:[~2005-11-16 23:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051116233829.071CC5BF78@nox.op5.se \
    --to=exon@op5.se \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox