diff options
author | Xavi Hernandez <xhernandez@redhat.com> | 2018-07-06 20:23:35 +0200 |
---|---|---|
committer | Xavi Hernandez <xhernandez@redhat.com> | 2018-07-10 16:28:24 +0200 |
commit | 6dc5dfef819cad69d6d4b4c1c305efa74236ad84 (patch) | |
tree | 6b325caf478689d8113279191ca1916e5f5b32ea /xlators/mgmt/glusterd/src/glusterd-mgmt.c | |
parent | 03f1f5bdc46076178f1afdf8e2a76c5b973fe11f (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-mgmt.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-mgmt.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-mgmt.c index 33d5de45cd5..5b7d782a1e6 100644 --- a/xlators/mgmt/glusterd/src/glusterd-mgmt.c +++ b/xlators/mgmt/glusterd/src/glusterd-mgmt.c @@ -41,6 +41,7 @@ gd_mgmt_v3_collate_errors (struct syncargs *args, int op_ret, int op_errno, int is_operrstr_blk = 0; char *err_string = NULL; glusterd_peerinfo_t *peerinfo = NULL; + int32_t len = 0; this = THIS; GF_ASSERT (this); @@ -113,8 +114,11 @@ gd_mgmt_v3_collate_errors (struct syncargs *args, int op_ret, int op_errno, } if (args->errstr) { - snprintf (err_str, sizeof(err_str), - "%s\n%s", args->errstr, op_err); + len = snprintf (err_str, sizeof(err_str), + "%s\n%s", args->errstr, op_err); + if (len < 0) { + strcpy(err_str, "<error>"); + } GF_FREE (args->errstr); args->errstr = NULL; } else |