From 6106574e134517afa5688fe764ffa1c293d53bf7 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Fri, 12 Mar 2021 16:49:01 +0100 Subject: [PATCH] initctl: minor refactor, use systemf() instead of snprintf+system Signed-off-by: Joachim Wiberg --- src/initctl.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/initctl.c b/src/initctl.c index ed1e2753..68e5e622 100644 --- a/src/initctl.c +++ b/src/initctl.c @@ -149,7 +149,6 @@ static int toggle_debug(char *arg) static int do_log(char *svc) { - char cmd[128]; char *logfile = "/var/log/syslog"; if (!svc || !svc[0]) @@ -158,9 +157,7 @@ static int do_log(char *svc) if (!fexist(logfile)) logfile = "/var/log/messages"; - snprintf(cmd, sizeof(cmd), "cat %s | grep %s | tail -10", logfile, svc); - - return system(cmd); + return systemf("cat %s | grep %s | tail -10", logfile, svc); } static int do_runlevel(char *arg)