From ff7ee1ecd7a5562b79522853c8699f07df7fafc0 Mon Sep 17 00:00:00 2001 From: Santosh Kumar Pradhan Date: Wed, 20 Nov 2013 11:40:10 +0530 Subject: 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 Reviewed-on: http://review.gluster.org/6307 Reviewed-by: Rajesh Joseph Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/mgmt/glusterd/src/glusterd-utils.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'xlators/mgmt') diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index e93b88ecf..5a74b720f 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"); -- cgit