summaryrefslogtreecommitdiffstats
path: root/xlators/nfs/server/src
diff options
context:
space:
mode:
authorYaniv Kaul <ykaul@redhat.com>2018-08-02 16:02:33 +0300
committerAmar Tumballi <amarts@redhat.com>2018-08-14 05:15:04 +0000
commitb2b6ab8eff317f6a507ab23897ea6cd5c718d99a (patch)
tree45fb1392f535f0236f057d9d9c932feda4f9ab40 /xlators/nfs/server/src
parent32c8f70f49c0e287c53998e37867f00fa775377b (diff)
All: remove memset() before sprintf()
It's not needed. There's a good chance the compiler is smart enough to remove it anyway, but it can't hurt - I hope. Compile-tested only! Change-Id: Id7c054e146ba630227affa591007803f3046416b updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
Diffstat (limited to 'xlators/nfs/server/src')
-rw-r--r--xlators/nfs/server/src/nfs.c3
-rw-r--r--xlators/nfs/server/src/nfs3.c10
2 files changed, 5 insertions, 8 deletions
diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c
index bf8132f..6a4415d 100644
--- a/xlators/nfs/server/src/nfs.c
+++ b/xlators/nfs/server/src/nfs.c
@@ -1664,7 +1664,6 @@ nfs_priv_to_dict (xlator_t *this, dict_t *dict, char *brickname)
if (!_nfs_export_is_for_vol (mentry->exname, volname))
continue;
- memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "client%d.hostname", count);
ret = dict_set_str (dict, key, mentry->hostname);
if (ret) {
@@ -1677,7 +1676,6 @@ nfs_priv_to_dict (xlator_t *this, dict_t *dict, char *brickname)
/* No connection data available yet in nfs server.
* Hence, setting to 0 to prevent cli failing
*/
- memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "client%d.bytesread", count);
ret = dict_set_uint64 (dict, key, 0);
if (ret) {
@@ -1687,7 +1685,6 @@ nfs_priv_to_dict (xlator_t *this, dict_t *dict, char *brickname)
goto out;
}
- memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "client%d.byteswrite", count);
ret = dict_set_uint64 (dict, key, 0);
if (ret) {
diff --git a/xlators/nfs/server/src/nfs3.c b/xlators/nfs/server/src/nfs3.c
index 93f5124ac..b62e249 100644
--- a/xlators/nfs/server/src/nfs3.c
+++ b/xlators/nfs/server/src/nfs3.c
@@ -5535,7 +5535,7 @@ nfs3_init_subvolume_options (xlator_t *nfsx,
if (gf_nfs_dvm_off (nfs_state (nfsx)))
goto no_dvm;
- ret = snprintf (searchkey, 1024, "nfs3.%s.volume-id",exp->subvol->name);
+ ret = snprintf (searchkey, sizeof (searchkey), "nfs3.%s.volume-id",exp->subvol->name);
if (ret < 0) {
gf_msg (GF_MNT, GF_LOG_ERROR, 0, NFS_MSG_SNPRINTF_FAIL,
"snprintf failed");
@@ -5574,7 +5574,7 @@ nfs3_init_subvolume_options (xlator_t *nfsx,
no_dvm:
/* Volume Access */
name = exp->subvol->name;
- ret = snprintf (searchkey, 1024, "nfs3.%s.volume-access", name);
+ ret = snprintf (searchkey, sizeof (searchkey), "nfs3.%s.volume-access", name);
if (ret < 0) {
gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_SNPRINTF_FAIL,
"snprintf failed");
@@ -5596,7 +5596,7 @@ no_dvm:
exp->access = GF_NFS3_VOLACCESS_RO;
}
- ret = snprintf (searchkey, 1024, "rpc-auth.%s.unix", name);
+ ret = snprintf (searchkey, sizeof (searchkey), "rpc-auth.%s.unix", name);
if (ret < 0) {
gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_SNPRINTF_FAIL,
"snprintf failed");
@@ -5615,7 +5615,7 @@ no_dvm:
}
exp->trusted_sync = 0;
- ret = snprintf (searchkey, 1024, "nfs3.%s.trusted-sync", name);
+ ret = snprintf (searchkey, sizeof (searchkey), "nfs3.%s.trusted-sync", name);
if (ret < 0) {
gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_SNPRINTF_FAIL,
"snprintf failed");
@@ -5646,7 +5646,7 @@ no_dvm:
}
exp->trusted_write = 0;
- ret = snprintf (searchkey, 1024, "nfs3.%s.trusted-write", name);
+ ret = snprintf (searchkey, sizeof (searchkey), "nfs3.%s.trusted-write", name);
if (ret < 0) {
gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_SNPRINTF_FAIL,
"snprintf failed");