Skip to content

Commit

Permalink
svc.c: change strncmp to string_compare
Browse files Browse the repository at this point in the history
strncmp can not handle the case when name is a substring of cmd.

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
  • Loading branch information
liuming50 committed Feb 5, 2022
1 parent e51587c commit cfffcd4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/svc.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ svc_t *svc_named_iterator(svc_t **iter, int first, char *cmd)
for (svc = svc_iterator(iter, first); svc; svc = svc_iterator(iter, 0)) {
char *name = svc->name;

if (!strncmp(name, cmd, strlen(name)))
if (string_compare(name, cmd))
return svc;
}

Expand Down

0 comments on commit cfffcd4

Please sign in to comment.