From ac0edc9b378fedb296d2874f367c0f5492c6d00e Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Sun, 21 Jun 2015 18:54:23 +0200 Subject: [PATCH] initctl: Fix broken presentation of inetd services in verbose mode. Signed-off-by: Joachim Nilsson --- api.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/api.c b/api.c index 3ffd0f05..5a501e24 100644 --- a/api.c +++ b/api.c @@ -113,13 +113,20 @@ static int do_restart(char *buf, size_t len) { return call(service_restart, buf, static int do_query_inetd(char *buf, size_t len) { - char *input = sanitize(buf, len); + int id = 1; + char *ptr, *input = sanitize(buf, len); svc_t *svc; if (!input) return -1; - svc = svc_find_by_jobid(atonum(input), 1); + ptr = strchr(input, ':'); + if (ptr) { + *ptr++ = 0; + id = atonum(ptr); + } + + svc = svc_find_by_jobid(atonum(input), id); if (!svc || !svc_is_inetd(svc)) { _e("Cannot %s svc %s ...", !svc ? "find" : "query, not an inetd", input); return 1;