From: 2xsec Date: Sun, 1 Jul 2018 13:37:00 +0000 (+0900) Subject: tools: lxc-autostart: remove the trailing . & fix coding style of strncmp X-Git-Tag: lxc-3.1.0~225^2~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=54d47131137cc679b756e93f3a92ecea980f5998;p=thirdparty%2Flxc.git tools: lxc-autostart: remove the trailing . & fix coding style of strncmp Signed-off-by: 2xsec --- diff --git a/src/lxc/tools/lxc_autostart.c b/src/lxc/tools/lxc_autostart.c index e19c8c273..96fce421d 100644 --- a/src/lxc/tools/lxc_autostart.c +++ b/src/lxc/tools/lxc_autostart.c @@ -111,17 +111,14 @@ static int list_contains_entry(char *str_ptr, struct lxc_list *p1) { * If the entry is NULL or the empty string and the list * is NULL, we have a match */ - if (!p1 && !str_ptr) - return 1; - - if (!p1 && !(*str_ptr)) + if (!p1 && (!str_ptr || !*str_ptr)) return 1; if (!p1) return 0; lxc_list_for_each(it1, p1) { - if (!strncmp(it1->elem, str_ptr, strlen(it1->elem))) + if (strncmp(it1->elem, str_ptr, strlen(it1->elem)) == 0) return 1; } @@ -361,7 +358,7 @@ int main(int argc, char *argv[]) qsort(&containers[0], count, sizeof(struct lxc_container *), cmporder); if (cmd_groups_list && my_args.all) - ERROR("Specifying -a (all) with -g (groups) doesn't make sense. All option overrides."); + ERROR("Specifying -a (all) with -g (groups) doesn't make sense. All option overrides"); /* We need a default cmd_groups_list even for the -a * case in order to force a pass through the loop for @@ -391,7 +388,7 @@ int main(int argc, char *argv[]) */ if (!c->may_control(c)) { /* We're done with this container */ - if ( lxc_container_put(c) > 0 ) + if (lxc_container_put(c) > 0) containers[i] = NULL; continue;