summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-utils.c
diff options
context:
space:
mode:
authorSanju Rakonde <srakonde@redhat.com>2018-06-02 01:38:10 +0530
committerAtin Mukherjee <amukherj@redhat.com>2018-06-11 20:01:20 +0000
commit9647f0c64bfb0af2e4354998d1be672f7101a358 (patch)
tree618fbb13c3edf6267c65d9687afa629943c79fda /xlators/mgmt/glusterd/src/glusterd-utils.c
parente00d6ba4ad0a0d92907363b56e241b4f515b4dca (diff)
glusterd: Coverity Fixes
Fixes: #789278 Change-Id: I633704fab49992cac6ee9e05bc368f7da360d09e Signed-off-by: Sanju Rakonde <srakonde@redhat.com> Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 22c23df131e..07987418a7f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -1254,8 +1254,9 @@ glusterd_brickinfo_new_from_brick (char *brick,
ret = gf_canonicalize_path (path);
if (ret)
goto out;
- strncpy (new_brickinfo->hostname, hostname, 1024);
- strncpy (new_brickinfo->path, path, 1024);
+ gf_strncpy (new_brickinfo->hostname, hostname,
+ sizeof(new_brickinfo->hostname));
+ gf_strncpy (new_brickinfo->path, path, sizeof(new_brickinfo->path));
if (construct_real_path) {
ret = glusterd_hostname_to_uuid (new_brickinfo->hostname,
@@ -7489,7 +7490,7 @@ out:
}
if (*in_use) {
- if (!strcmp (path, curdir)) {
+ if (path && curdir && !strcmp (path, curdir)) {
snprintf (msg, sizeof (msg), "%s is already part of a "
"volume", path);
} else {