cli: fix DEADCODE (CWE-561) found by coverity

Error: DEADCODE (CWE-561): [#def3]
NetworkManager-0.9.11.0/clients/cli/utils.c:488: cond_notnull: Condition "input", taking true branch. Now the value of "input" is not "NULL".
NetworkManager-0.9.11.0/clients/cli/utils.c:517: notnull: At condition "input", the value of "input" cannot be "NULL".
NetworkManager-0.9.11.0/clients/cli/utils.c:517: dead_error_condition: The condition "input" must be true.
NetworkManager-0.9.11.0/clients/cli/utils.c:517: dead_error_line: Execution cannot reach the expression """" inside this statement: "g_set_error(error, 1U, 0, d...".

(cherry picked from commit bcd5b2cdc1)
This commit is contained in:
Jiří Klimeš 2014-12-12 21:38:37 +01:00 committed by Thomas Haller
parent 932f1ca63e
commit 3034fe9f4d

View file

@ -510,13 +510,10 @@ nmc_string_is_valid (const char *input, const char **allowed, GError **error)
finish:
if (ret == NULL) {
char *valid_vals = g_strjoinv (", ", (char **) allowed);
if (!input || !*input) {
g_set_error (error, 1, 0, _("missing name, try one of [%s]"),
valid_vals);
} else {
g_set_error (error, 1, 0, _("'%s' not among [%s]"),
input ? input : "", valid_vals);
}
if (!input || !*input)
g_set_error (error, 1, 0, _("missing name, try one of [%s]"), valid_vals);
else
g_set_error (error, 1, 0, _("'%s' not among [%s]"), input, valid_vals);
g_free (valid_vals);
}