summaryrefslogtreecommitdiff
path: root/clients
diff options
context:
space:
mode:
authorJiří Klimeš <jklimes@redhat.com>2014-12-12 21:38:37 +0100
committerJiří Klimeš <jklimes@redhat.com>2014-12-12 22:43:33 +0100
commitbcd5b2cdc1d81c7914c6aa490dd140ce7046a625 (patch)
tree6ee33c1a59b0527e7dde559a2d7e9cbf0e24c970 /clients
parented088b0df7df2e5fc9ccd0a516cb18f74b1b6022 (diff)
downloadNetworkManager-bcd5b2cdc1d81c7914c6aa490dd140ce7046a625.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...".
Diffstat (limited to 'clients')
-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);
}