From 8725200260d06000dadd53d7985c912cc80d5923 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Thu, 22 Oct 2015 18:50:47 +0200 Subject: [PATCH] Build fixes for configure --disable-inetd service.c: Don't declare find_inetd_svc() if inetd is disabled. api.c: Disable inetd API initctl.c: Disable presentation of inetd services Signed-off-by: Joachim Nilsson --- api.c | 5 +++++ initctl.c | 17 ++++++++++------- service.c | 3 ++- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/api.c b/api.c index 0327ae5d..954ea224 100644 --- a/api.c +++ b/api.c @@ -30,6 +30,7 @@ #include #include +#include "config.h" #include "finit.h" #include "conf.h" #include "helpers.h" @@ -112,6 +113,7 @@ static int do_stop (char *buf, size_t len) { return call(service_stop, buf, static int do_reload (char *buf, size_t len) { return call(service_reload, buf, len); } static int do_restart(char *buf, size_t len) { return call(service_restart, buf, len); } +#ifndef INETD_DISABLED static int do_query_inetd(char *buf, size_t len) { int id = 1; @@ -135,6 +137,7 @@ static int do_query_inetd(char *buf, size_t len) return inetd_filter_str(&svc->inetd, buf, len); } +#endif /* !INETD_DISABLED */ typedef struct { char *event; @@ -275,9 +278,11 @@ static void cb(uev_t *w, void *UNUSED(arg), int UNUSED(events)) result = do_restart(rq.data, sizeof(rq.data)); break; +#ifndef INETD_DISABLED case INIT_CMD_QUERY_INETD: result = do_query_inetd(rq.data, sizeof(rq.data)); break; +#endif case INIT_CMD_EMIT: result = do_handle_emit(rq.data, sizeof(rq.data)); diff --git a/initctl.c b/initctl.c index 39f53c62..1e38245e 100644 --- a/initctl.c +++ b/initctl.c @@ -149,12 +149,7 @@ static int show_status(char *UNUSED(arg)) } for (svc = svc_iterator(1); svc; svc = svc_iterator(0)) { - int inetd = svc_is_inetd(svc); char jobid[10], args[512] = ""; - struct init_request rq = { - .magic = INIT_MAGIC, - .cmd = INIT_CMD_QUERY_INETD, - }; if (svc_is_unique(svc)) snprintf(jobid, sizeof(jobid), "%d", svc->job); @@ -167,8 +162,13 @@ static int show_status(char *UNUSED(arg)) continue; } - if (inetd) { +#ifndef INETD_DISABLED + if (svc_is_inetd(svc)) { char *info; + struct init_request rq = { + .magic = INIT_MAGIC, + .cmd = INIT_CMD_QUERY_INETD, + }; snprintf(rq.data, sizeof(rq.data), "%s", jobid); if (do_send(&rq, sizeof(rq))) { @@ -184,7 +184,10 @@ static int show_status(char *UNUSED(arg)) } printf("%s %s\n", svc->cmd, info); - } else { + } + else +#endif /* !INETD_DISABLED */ + { int i; for (i = 1; i < MAX_NUM_SVC_ARGS; i++) { diff --git a/service.c b/service.c index cd7cac84..87862922 100644 --- a/service.c +++ b/service.c @@ -44,8 +44,9 @@ static int is_norespawn (void); static void restart_lost_procs (void); static void svc_dance (svc_t *svc); +#ifndef INETD_DISABLED static svc_t *find_inetd_svc (char *path, char *service, char *proto); - +#endif /** * service_bootstrap - Start bootstrap services and tasks