diff options
author | Vijay Bellur <vbellur@redhat.com> | 2013-08-25 20:51:20 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2013-09-06 00:36:29 -0700 |
commit | 1ad4d0457da4366028affffddb6fa1d3725ef22e (patch) | |
tree | 9f8c0bdf1bd97b15e841c62c8cd0007e06fae712 /api | |
parent | 06d2e2a93f00550eaac68ce0f731e8ffa8850c79 (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/5711
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'api')
-rw-r--r-- | api/src/glfs-mgmt.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/api/src/glfs-mgmt.c b/api/src/glfs-mgmt.c index a76692bfd06..925029d5c1d 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); } |