summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2012-04-13 17:29:41 +0530
committerAnand Avati <avati@redhat.com>2012-04-23 14:52:57 -0700
commit29f2de478cc6a475e6ae760d9cbe7ac847e9d79c (patch)
tree621fbb33e6e3de20f7c1b59a98e181c7b50b4796 /xlators/mgmt/glusterd/src/glusterd-geo-rep.c
parent4c9e8fad23836d87b0c4327e990c789630fe5b97 (diff)
core: coverity issues fixed
this is not a complete set of issues getting fixed. Will address other issues in another patch. Change-Id: Ib01c7b11b205078cc4d0b3f11610751e32d14b69 Signed-off-by: Amar Tumballi <amarts@redhat.com> BUG: 789278 Reviewed-on: http://review.gluster.com/3145 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-geo-rep.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-geo-rep.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
index 4dc93966..c373fc14 100644
--- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
+++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
@@ -524,7 +524,7 @@ gsync_status (char *master, char *slave, int *status)
int fd = -1;
fd = gsyncd_getpidfile (master, slave, pidfile);
- if (fd == -2)
+ if ((fd == -2) || (fd == -1))
return -1;
*status = gsync_status_byfd (fd);
@@ -1118,7 +1118,7 @@ stop_gsync (char *master, char *slave, char **msg)
GF_ASSERT (THIS->private);
pfd = gsyncd_getpidfile (master, slave, pidfile);
- if (pfd == -2) {
+ if ((pfd == -2) || (pfd == -1)) {
gf_log ("", GF_LOG_ERROR, GEOREP" stop validation "
" failed for %s & %s", master, slave);
ret = -1;
@@ -1160,7 +1160,8 @@ stop_gsync (char *master, char *slave, char **msg)
ret = 0;
out:
- close (pfd);
+ if ((pfd != -2) && (pfd != -1))
+ close (pfd);
return ret;
}
@@ -1652,7 +1653,7 @@ glusterd_get_pid_from_file (char *master, char *slave, pid_t *pid)
pfd = gsyncd_getpidfile (master, slave, pidfile);
- if (pfd == -2) {
+ if ((pfd == -2) || (pfd == -1)) {
gf_log ("", GF_LOG_ERROR, GEOREP" log-rotate validation "
" failed for %s & %s", master, slave);
goto out;
@@ -1669,12 +1670,13 @@ glusterd_get_pid_from_file (char *master, char *slave, pid_t *pid)
goto out;
}
- close(pfd);
*pid = strtol (buff, NULL, 10);
ret = 0;
- out:
+out:
+ if ((pfd != -2) && (pfd != -1))
+ close(pfd);
return ret;
}