Fix returning a service descriptions.
This commit is contained in:
parent
06635dedbc
commit
a1b9768243
@ -447,12 +447,12 @@ char *rc_service_description(const char *service, const char *option)
|
|||||||
if (! (svc = rc_service_resolve(service)))
|
if (! (svc = rc_service_resolve(service)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (! option)
|
if (!option)
|
||||||
option = "";
|
option = "";
|
||||||
|
|
||||||
l = strlen(DESCSTR) + strlen(svc) + strlen(option) + 2;
|
l = strlen(DESCSTR) + strlen(svc) + strlen(option) + 2;
|
||||||
cmd = xmalloc(sizeof(char) * l);
|
cmd = xmalloc(sizeof(char) * l);
|
||||||
snprintf(cmd, l, DESCSTR, svc, option ? "_" : "", option);
|
snprintf(cmd, l, DESCSTR, svc, *option ? "_" : "", option);
|
||||||
free(svc);
|
free(svc);
|
||||||
if ((fp = popen(cmd, "r"))) {
|
if ((fp = popen(cmd, "r"))) {
|
||||||
rc_getline(&desc, &len, fp);
|
rc_getline(&desc, &len, fp);
|
||||||
|
Loading…
Reference in New Issue
Block a user