From f7cd46abc915c0af2d778c14de1214de8c23a83b Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Sun, 15 Jan 2017 21:15:58 +0100 Subject: [PATCH] API: Check input argument Signed-off-by: Joachim Nilsson --- api.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/api.c b/api.c index 3a3575f9..0a36af32 100644 --- a/api.c +++ b/api.c @@ -116,6 +116,9 @@ static int call(int (*action)(svc_t *), char *buf, size_t len) static int service_block(svc_t *svc) { + if (!svc) + return 1; + svc_block(svc); service_step(svc); @@ -124,6 +127,9 @@ static int service_block(svc_t *svc) static int service_unblock(svc_t *svc) { + if (!svc) + return 1; + svc_unblock(svc); service_step(svc); @@ -132,8 +138,12 @@ static int service_unblock(svc_t *svc) static int service_restart(svc_t *svc) { + if (!svc) + return 1; + svc_mark_dirty(svc); service_step(svc); + return 0; }