summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-handler.c
diff options
context:
space:
mode:
authorXavi Hernandez <xhernandez@redhat.com>2018-07-06 20:23:35 +0200
committerXavi Hernandez <xhernandez@redhat.com>2018-07-10 16:28:24 +0200
commit6dc5dfef819cad69d6d4b4c1c305efa74236ad84 (patch)
tree6b325caf478689d8113279191ca1916e5f5b32ea /xlators/mgmt/glusterd/src/glusterd-handler.c
parent03f1f5bdc46076178f1afdf8e2a76c5b973fe11f (diff)
Fix compile warnings
This patch fixes compile warnings that appear with newer compilers. The solution applied is only to remove the warnings, but it doesn't always solve the problem in the best way. It assumes that the problem will never happen, as the previous code assumed. Change-Id: I6e8470d6c2e2dbd3bd7d324b5fd2f92ffdc3d6ec updates: bz#1193929 Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-handler.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index dd81887ed1f..b59d3819d95 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -471,6 +471,7 @@ glusterd_add_volume_detail_to_dict (glusterd_volinfo_t *volinfo,
struct args_pack pack = {0,};
xlator_t *this = NULL;
GF_UNUSED int caps = 0;
+ int32_t len = 0;
GF_ASSERT (volinfo);
GF_ASSERT (volumes);
@@ -654,8 +655,12 @@ glusterd_add_volume_detail_to_dict (glusterd_volinfo_t *volinfo,
char brick[1024] = {0,};
char brick_uuid[64] = {0,};
snprintf (key, 256, "volume%d.brick%d", count, i);
- snprintf (brick, 1024, "%s:%s", brickinfo->hostname,
- brickinfo->path);
+ len = snprintf (brick, 1024, "%s:%s", brickinfo->hostname,
+ brickinfo->path);
+ if ((len < 0) || (len >= 1024)) {
+ ret = -1;
+ goto out;
+ }
buf = gf_strdup (brick);
ret = dict_set_dynstr (volumes, key, buf);
if (ret)