summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/server/src/server-helpers.c
diff options
context:
space:
mode:
authorAnoop C S <anoopcs@redhat.com>2017-07-27 14:20:31 +0530
committerJeff Darcy <jeff@pl.atyp.us>2017-08-09 13:00:31 +0000
commit6a0112e2c101a5ccf39124e45020f22c7716da5c (patch)
tree6becda184124eb8ac31542d539258813e81cfa14 /xlators/protocol/server/src/server-helpers.c
parent071559cb4745669c87198128ab73d7af2017e9bd (diff)
protocol/server: Fix Wint-in-bool-context compiler warning
Following warning is shown when compiled with gcc v7: server-helpers.c: In function ‘auth_set_username_passwd’: server-helpers.c:1282:65: warning: ?: using integer constants in boolean context [-Wint-in-bool-context] ret = !((strcmp (data_to_str (passwd_data), ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ password))?0: -1); ~~~~~~~~~~~~^~~~~ CCLD server.la Previously we used to have integers being used in context where boolean values were intended with ternay oprations and it was hard to understand the logic. This change simplifies the logic so that it avoids the warning too. Change-Id: Ie533cf34f829b9fcfeb79f3d519a0ac3cb7f2ab8 Updates: #259 Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-on: https://review.gluster.org/17895 Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: mohammed rafi kc <rkavunga@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
Diffstat (limited to 'xlators/protocol/server/src/server-helpers.c')
-rw-r--r--xlators/protocol/server/src/server-helpers.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c
index 381fb6f515e..e6def55c745 100644
--- a/xlators/protocol/server/src/server-helpers.c
+++ b/xlators/protocol/server/src/server-helpers.c
@@ -1282,19 +1282,19 @@ auth_set_username_passwd (dict_t *input_params, dict_t *config_params,
goto out;
}
- ret = !((strcmp (data_to_str (passwd_data),
- password))?0: -1);
+ ret = strcmp (data_to_str (passwd_data),
+ password);
if (!ret) {
client->auth.username =
gf_strdup (username);
client->auth.passwd =
gf_strdup (password);
- }
- if (ret == -1)
+ } else {
gf_msg ("auth/login", GF_LOG_ERROR, 0,
PS_MSG_LOGIN_ERROR, "wrong "
"password for user %s",
username);
+ }
break;
}
username_str = strtok_r (NULL, " ,", &tmp);