daemon: use a custom die routine with syslog
Removed the git-daemon prefix from die() because no other call to die does this. Signed-off-by: Matthias Lederhofer <matled@gmx.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
Matthias Lederhofer committed
Jul 13, 2006 at 12:02 UTC
ad8b4f56b5ec1e5385156c20d95649ea8cee6af4
1 file changed
+11
-8
daemon.c
+11
-8
@@ -95,6 +95,12 @@ static void loginfo(const char *err, ...)
95
va_end(params);
96
}
97
98
+static void NORETURN daemon_die(const char *err, va_list params)
99
+{
100
+ logreport(LOG_ERR, err, params);
101
+ exit(1);
102
+}
103
+
104
static int avoid_alias(char *p)
105
{
106
int sl, ndot;
@@ -746,17 +752,14 @@ int main(int argc, char **argv)
752
usage(daemon_usage);
753
}
754
749
- if (log_syslog)
755
+ if (log_syslog) {
756
openlog("git-daemon", 0, LOG_DAEMON);
751
-
752
- if (strict_paths && (!ok_paths || !*ok_paths)) {
753
- if (!inetd_mode)
754
- die("git-daemon: option --strict-paths requires a whitelist");
755
-
756
- logerror("option --strict-paths requires a whitelist");
757
- exit (1);
757
+ set_die_routine(daemon_die);
758
}
759
760
+ if (strict_paths && (!ok_paths || !*ok_paths))
761
+ die("option --strict-paths requires a whitelist");
762
+
763
if (inetd_mode) {
764
struct sockaddr_storage ss;
765
struct sockaddr *peer = (struct sockaddr *)&ss;