summaryrefslogtreecommitdiffstats
path: root/api/src
diff options
context:
space:
mode:
authorVijay Bellur <vbellur@redhat.com>2013-08-25 20:51:20 +0530
committerAnand Avati <avati@redhat.com>2013-08-25 13:03:24 -0700
commitcd2537541540074a5db452a49f9be220e3d76d32 (patch)
tree751da8bc1bef903c729883376cbc6cfd85faa9ca /api/src
parent2991503d014f634da5cd10bcb851e986a3dcd5c2 (diff)
api: Set errno before invoking glfs_init_done()
Change-Id: I3f4d3cfaf7078e126881111eb840d854b0b6466d BUG: 860212 Signed-off-by: Vijay Bellur <vbellur@redhat.com> Reviewed-on: http://review.gluster.org/5704 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'api/src')
-rw-r--r--api/src/glfs-mgmt.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/api/src/glfs-mgmt.c b/api/src/glfs-mgmt.c
index a76692bf..925029d5 100644
--- a/api/src/glfs-mgmt.c
+++ b/api/src/glfs-mgmt.c
@@ -416,6 +416,7 @@ mgmt_getspec_cbk (struct rpc_req *req, struct iovec *iov, int count,
gf_log (frame->this->name, GF_LOG_ERROR,
"failed to get the 'volume file' from server");
ret = -1;
+ errno = rsp.op_errno;
goto out;
}
@@ -481,6 +482,7 @@ out:
if (ENOTSUP == ret) {
gf_log ("mgmt", GF_LOG_ERROR, "Server is operating at an "
"op-version which is not supported");
+ errno = ENOTSUP;
glfs_init_done (fs, -1);
}
@@ -491,8 +493,11 @@ out:
gf_log ("glfs-mgmt", GF_LOG_ERROR,
"failed to fetch volume file (key:%s)",
ctx->cmd_args.volfile_id);
- if (!need_retry)
+ if (!need_retry) {
+ if (!errno)
+ errno = EINVAL;
glfs_init_done (fs, -1);
+ }
}
if (tmpfp)
@@ -583,9 +588,10 @@ mgmt_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
gf_log ("glfs-mgmt", GF_LOG_INFO,
"%d connect attempts left",
cmd_args->max_connect_attempts);
- if (0 >= cmd_args->max_connect_attempts)
+ if (0 >= cmd_args->max_connect_attempts) {
+ errno = ENOTCONN;
glfs_init_done (fs, -1);
- break;
+ }
}
break;
case RPC_CLNT_CONNECT:
@@ -594,10 +600,11 @@ mgmt_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
ret = glfs_volfile_fetch (fs);
if (ret && ctx && (ctx->active == NULL)) {
/* Do it only for the first time */
- /* Exit the process.. there is some wrong options */
+ /* Exit the process.. there are some wrong options */
gf_log ("glfs-mgmt", GF_LOG_ERROR,
"failed to fetch volume file (key:%s)",
ctx->cmd_args.volfile_id);
+ errno = EINVAL;
glfs_init_done (fs, -1);
}