diff options
author | Sheetal Pamecha <spamecha@redhat.com> | 2019-07-01 20:48:31 +0530 |
---|---|---|
committer | Sheetal Pamecha <spamecha@redhat.com> | 2019-07-02 07:29:32 +0000 |
commit | 080827829eabd3cbed1a7feaa37de091834fcbb1 (patch) | |
tree | 9dbf63dcfa160260d4b98d269c24789c780ae3da /cli/src/cli-rpc-ops.c | |
parent | cbc234d9ddfb7e2f0089d7ba9d1dd81b0367ba8f (diff) |
cli: Remove Wformat-truncation compiler warning
This warning is issued due to unhandled output truncation.
As in the code, truncation is expected, we can remove this
warning by placing a check on the return value of the function
and handling it.
In this way, the warning will not be issued.
Change-Id: I1820b58fe9a7601961c20944b259df322db35057
updates: bz#1193929
Signed-off-by: Sheetal Pamecha <spamecha@redhat.com>
Diffstat (limited to 'cli/src/cli-rpc-ops.c')
-rw-r--r-- | cli/src/cli-rpc-ops.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 35985ab44c6..9757fe338f3 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -2876,8 +2876,10 @@ print_quota_list_output(cli_local_t *local, char *path, char *default_sl, sl_final = default_sl; } else { sl_num = (limits->sl * limits->hl) / 100; - snprintf(percent_str, sizeof(percent_str), "%" PRIu64 "%%", - limits->sl); + ret = snprintf(percent_str, sizeof(percent_str), "%" PRIu64 "%%", + limits->sl); + if (ret < 0) + goto out; sl_final = percent_str; } if (type == GF_QUOTA_OPTION_TYPE_LIST) |