summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSantosh Kumar Pradhan <spradhan@redhat.com>2013-11-20 11:40:10 +0530
committerAnand Avati <avati@redhat.com>2013-11-20 13:41:26 -0800
commitff7ee1ecd7a5562b79522853c8699f07df7fafc0 (patch)
tree80fbf26c194278d3517510eea026061f3f487d16
parent3c38ba1e7b4959602f945112a26b8aee904fefaa (diff)
gNFS: Coverity fix for CID 1128906
Fix the Coverity issue introduced in RFE: NFS volume set/reset commit i.e. http://review.gluster.org/6236 Change-Id: I817b9da03a3ce7f5511303faea0c50dfdad60ff4 BUG: 1027409 Signed-off-by: Santosh Kumar Pradhan <spradhan@redhat.com> Reviewed-on: http://review.gluster.org/6307 Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index e93b88ecfdc..5a74b720fc1 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -6410,23 +6410,25 @@ glusterd_defrag_volume_status_update (glusterd_volinfo_t *volinfo,
}
int
-glusterd_check_topology_identical (const char *filename1,
- const char *filename2,
+glusterd_check_topology_identical (const char *filename1,
+ const char *filename2,
gf_boolean_t *identical)
{
- int ret = -1; /* FAILURE */
- xlator_t *this = NULL;
- FILE *fp1 = NULL;
- FILE *fp2 = NULL;
+ int ret = -1; /* FAILURE */
+ xlator_t *this = THIS;
+ FILE *fp1 = NULL;
+ FILE *fp2 = NULL;
glusterfs_graph_t *grph1 = NULL;
glusterfs_graph_t *grph2 = NULL;
- if ((!filename1) || (!filename2) || (!identical))
- goto out;
-
- this = THIS;
+ /* Invalid xlator, Nothing to do */
+ if (!this)
+ return (-1);
- errno = 0; /* RESET the errno */
+ /* Sanitize the inputs */
+ GF_VALIDATE_OR_GOTO (this->name, filename1, out);
+ GF_VALIDATE_OR_GOTO (this->name, filename2, out);
+ GF_VALIDATE_OR_GOTO (this->name, identical, out);
/* fopen() the volfile1 to create the graph */
fp1 = fopen (filename1, "r");