aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/librc/librc.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/librc/librc.c b/src/librc/librc.c
index f2f694df..5feb5d7a 100644
--- a/src/librc/librc.c
+++ b/src/librc/librc.c
@@ -550,14 +550,16 @@ rc_service_extra_commands(const char *service)
if ((fp = popen(cmd, "r"))) {
rc_getline(&buffer, &len, fp);
p = buffer;
- while ((token = strsep(&p, " "))) {
- if (!commands)
- commands = rc_stringlist_new();
- rc_stringlist_add(commands, token);
- }
+ commands = rc_stringlist_new();
+
+ while ((token = strsep(&p, " ")))
+ if (token[0] != '\0')
+ rc_stringlist_add(commands, token);
+
pclose(fp);
free(buffer);
}
+
free(cmd);
return commands;
}