daemon: make --inetd and --detach incompatible
Since --inetd makes main return with the result of execute() before daemonize is gets called, these two options are already incompatible. Document it, and add an error if attempted. Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Erik Faye-Lund committed
Nov 4, 2010 at 02:35 UTC
9cddf56ef13c8575ac0c68d82e6196e5b0a2900d
2 files changed
+6
-5
Documentation/git-daemon.txt
+2
-1
@@ -78,7 +78,8 @@ OPTIONS
78
79
--inetd::
80
Have the server run as an inetd service. Implies --syslog.
81
- Incompatible with --port, --listen, --user and --group options.
81
+ Incompatible with --detach, --port, --listen, --user and --group
82
+ options.
83
84
--listen=<host_or_ipaddr>::
85
Listen on a specific IP address or hostname. IP addresses can
daemon.c
+4
-4
@@ -23,10 +23,10 @@ static const char daemon_usage[] =
23
" [--strict-paths] [--base-path=<path>] [--base-path-relaxed]\n"
24
" [--user-path | --user-path=<path>]\n"
25
" [--interpolated-path=<path>]\n"
26
-" [--reuseaddr] [--detach] [--pid-file=<file>]\n"
26
+" [--reuseaddr] [--pid-file=<file>]\n"
27
" [--(enable|disable|allow-override|forbid-override)=<service>]\n"
28
" [--inetd | [--listen=<host_or_ipaddr>] [--port=<n>]\n"
29
-" [--user=<user> [--group=<group>]]\n"
29
+" [--detach] [--user=<user> [--group=<group>]]\n"
30
" [<directory>...]";
31
32
/* List of acceptable pathname prefixes */
@@ -1128,8 +1128,8 @@ int main(int argc, char **argv)
1128
/* avoid splitting a message in the middle */
1129
setvbuf(stderr, NULL, _IOFBF, 4096);
1130
1131
- if (inetd_mode && (group_name || user_name))
1132
- die("--user and --group are incompatible with --inetd");
1131
+ if (inetd_mode && (detach || group_name || user_name))
1132
+ die("--detach, --user and --group are incompatible with --inetd");
1133
1134
if (inetd_mode && (listen_port || (listen_addr.nr > 0)))
1135
die("--listen= and --port= are incompatible with --inetd");