fix rc_service_extra_commands return value
If there were no extra commands, rc_service_extra_commands returned a list containing a single empty string. This changes that to return an empty list, which is more consistent with what you would expect. X-Gentoo-Bug: 360013 X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=360013
This commit is contained in:
parent
04e256e3b8
commit
8fcaba9a22
@ -550,14 +550,16 @@ rc_service_extra_commands(const char *service)
|
|||||||
if ((fp = popen(cmd, "r"))) {
|
if ((fp = popen(cmd, "r"))) {
|
||||||
rc_getline(&buffer, &len, fp);
|
rc_getline(&buffer, &len, fp);
|
||||||
p = buffer;
|
p = buffer;
|
||||||
while ((token = strsep(&p, " "))) {
|
|
||||||
if (!commands)
|
|
||||||
commands = rc_stringlist_new();
|
commands = rc_stringlist_new();
|
||||||
|
|
||||||
|
while ((token = strsep(&p, " ")))
|
||||||
|
if (token[0] != '\0')
|
||||||
rc_stringlist_add(commands, token);
|
rc_stringlist_add(commands, token);
|
||||||
}
|
|
||||||
pclose(fp);
|
pclose(fp);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(cmd);
|
free(cmd);
|
||||||
return commands;
|
return commands;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user