summaryrefslogtreecommitdiffstats
path: root/xlators/features/quota/src/quotad.c
diff options
context:
space:
mode:
authorYaniv Kaul <ykaul@redhat.com>2018-09-23 11:04:22 +0300
committerAmar Tumballi <amarts@redhat.com>2018-09-26 04:17:30 +0000
commit341ba81448e869ae388b4b37556e47f6bf7413a5 (patch)
tree2867552e09e07d4320fc9cefb96a9533fc719658 /xlators/features/quota/src/quotad.c
parent064b24900e1f5e3ba3087f7c6a0249613ebed61f (diff)
Quota related files: use dict_{setn|getn|deln|get_int32n|set_int32n|set_strn}
In a previous patch (https://review.gluster.org/20769) we've added the key length to be passed to dict_* funcs, to remove the need to strlen() it. This patch moves some code to use it. Please review carefully. Compile-tested only! updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com> Change-Id: If4f425a9827be7c36ccfbb9761006ae824a818c6
Diffstat (limited to 'xlators/features/quota/src/quotad.c')
-rw-r--r--xlators/features/quota/src/quotad.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/xlators/features/quota/src/quotad.c b/xlators/features/quota/src/quotad.c
index 1b61468f183..5b0ab83673b 100644
--- a/xlators/features/quota/src/quotad.c
+++ b/xlators/features/quota/src/quotad.c
@@ -81,14 +81,16 @@ qd_find_subvol(xlator_t *this, char *volume_uuid)
xlator_list_t *child = NULL;
xlator_t *subvol = NULL;
char key[1024];
+ int keylen = 0;
char *optstr = NULL;
if (!this || !volume_uuid)
goto out;
for (child = this->children; child; child = child->next) {
- snprintf(key, 1024, "%s.volume-id", child->xlator->name);
- if (dict_get_str(this->options, key, &optstr) < 0)
+ keylen = snprintf(key, sizeof(key), "%s.volume-id",
+ child->xlator->name);
+ if (dict_get_strn(this->options, key, keylen, &optstr) < 0)
continue;
if (strcmp(optstr, volume_uuid) == 0) {
@@ -128,7 +130,8 @@ qd_nameless_lookup(xlator_t *this, call_frame_t *frame, gfs3_lookup_req *req,
memcpy(loc.gfid, req->gfid, 16);
- ret = dict_get_str(xdata, "volume-uuid", &volume_uuid);
+ ret = dict_get_strn(xdata, "volume-uuid", SLEN("volume-uuid"),
+ &volume_uuid);
if (ret < 0) {
op_errno = EINVAL;
goto out;