summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Stanley <joel@jms.id.au>2018-03-06 14:32:17 +1030
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>2018-03-07 16:24:31 +1100
commit352f5c2729dc8b40524e45ddde4f560ded717ec8 (patch)
tree762a5f36f4f5fb4e5ba5a5a26be93b49c1477a54
parenta5f80e0a9a40732b9d7606ad369b288ce04cec29 (diff)
downloadtalos-petitboot-352f5c2729dc8b40524e45ddde4f560ded717ec8.tar.gz
talos-petitboot-352f5c2729dc8b40524e45ddde4f560ded717ec8.zip
ncurses: Fix bad strncmp
ui/ncurses/nc-cui.c:967:58: warning: size argument in 'strncmp' call is a comparison [-Wmemsize-comparison] if (strncmp(cod->opt->id, "dummy", strlen("dummy") == 0 && ~~~~~~~~~~~~~~~~~~~~~^~ ui/ncurses/nc-cui.c:967:6: note: did you mean to compare the result of 'strncmp' instead? if (strncmp(cod->opt->id, "dummy", strlen("dummy") == 0 && ^ There appears to be two bonus conditions inside the length field. I chose to drop the pointless strncmp(foo, bar, strlen(bar)), as this is equivalent to strcmp(foo, bar). Signed-off-by: Joel Stanley <joel@jms.id.au> Reviewed-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> [Fixed up commit message typo]
-rw-r--r--ui/ncurses/nc-cui.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ui/ncurses/nc-cui.c b/ui/ncurses/nc-cui.c
index 372da1e..20a9048 100644
--- a/ui/ncurses/nc-cui.c
+++ b/ui/ncurses/nc-cui.c
@@ -964,8 +964,8 @@ fallback:
* If this option was faked above move the context under
* the item so it is cleaned up later in cui_plugins_remove().
*/
- if (strncmp(cod->opt->id, "dummy", strlen("dummy") == 0 &&
- cod->dev->type == DEVICE_TYPE_UNKNOWN)) {
+ if (strcmp(cod->opt->id, "dummy") == 0 &&
+ cod->dev->type == DEVICE_TYPE_UNKNOWN) {
talloc_steal(item, cod->dev);
talloc_steal(item, cod->opt);
}
OpenPOWER on IntegriCloud