mirror of
https://github.com/troglobit/finit.git
synced 2026-11-07 16:01:08 +00:00
initctl: minor refactor, use systemf() instead of snprintf+system
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
2385a1209b
commit
6106574e13
1 file changed
+1
-4
+1
-4
@@ -149,7 +149,6 @@ static int toggle_debug(char *arg)
|
|||||||
|
|
||||||
static int do_log(char *svc)
|
static int do_log(char *svc)
|
||||||
{
|
{
|
||||||
char cmd[128];
|
|
||||||
char *logfile = "/var/log/syslog";
|
char *logfile = "/var/log/syslog";
|
||||||
|
|
||||||
if (!svc || !svc[0])
|
if (!svc || !svc[0])
|
||||||
@@ -158,9 +157,7 @@ static int do_log(char *svc)
|
|||||||
if (!fexist(logfile))
|
if (!fexist(logfile))
|
||||||
logfile = "/var/log/messages";
|
logfile = "/var/log/messages";
|
||||||
|
|
||||||
snprintf(cmd, sizeof(cmd), "cat %s | grep %s | tail -10", logfile, svc);
|
return systemf("cat %s | grep %s | tail -10", logfile, svc);
|
||||||
|
|
||||||
return system(cmd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int do_runlevel(char *arg)
|
static int do_runlevel(char *arg)
|
||||||
|
|||||||
Reference in new issue
Block a user