summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiří Klimeš <jklimes@redhat.com>2014-12-12 21:38:37 +0100
committerThomas Haller <thaller@redhat.com>2014-12-16 21:47:01 +0100
commit3034fe9f4d33c0bdd4f8998495fdee260ea27069 (patch)
treea1a8029d2f54565663bb58c9c73cf4d089c1bdd1
parent932f1ca63ebf009e1ae3e291fa4ed1155a59d086 (diff)
downloadNetworkManager-3034fe9f4d33c0bdd4f8998495fdee260ea27069.tar.gz
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 bcd5b2cdc1d81c7914c6aa490dd140ce7046a625)
-rw-r--r--clients/cli/utils.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/clients/cli/utils.c b/clients/cli/utils.c
index cb8fbf018a..60cf9f93f5 100644
--- a/clients/cli/utils.c
+++ b/clients/cli/utils.c
@@ -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);
}