summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/src/glfs.c21
-rw-r--r--glusterfsd/src/glusterfsd.c6
2 files changed, 20 insertions, 7 deletions
diff --git a/api/src/glfs.c b/api/src/glfs.c
index 0dc535eb9e9..04ca7129e8e 100644
--- a/api/src/glfs.c
+++ b/api/src/glfs.c
@@ -68,13 +68,20 @@ glusterfs_ctx_defaults_init (glusterfs_ctx_t *ctx)
if (!ctx) {
goto err;
- }
- ret = xlator_mem_acct_init (THIS, glfs_mt_end + 1);
- if (ret != 0) {
- gf_log(THIS->name, GF_LOG_ERROR,
- "Memory accounting init failed");
- return ret;
- }
+ }
+
+ ret = xlator_mem_acct_init (THIS, glfs_mt_end + 1);
+ if (ret != 0) {
+ gf_log (THIS->name, GF_LOG_ERROR,
+ "Memory accounting init failed");
+ return ret;
+ }
+
+ /* reset ret to -1 so that we don't need to explicitly
+ * set it in all error paths before "goto err"
+ */
+
+ ret = -1;
ctx->process_uuid = generate_glusterfs_ctx_id ();
if (!ctx->process_uuid) {
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
index c23e83257e1..e854959daf6 100644
--- a/glusterfsd/src/glusterfsd.c
+++ b/glusterfsd/src/glusterfsd.c
@@ -1319,6 +1319,12 @@ glusterfs_ctx_defaults_init (glusterfs_ctx_t *ctx)
gf_msg(THIS->name, GF_LOG_CRITICAL, 0, glusterfsd_msg_34);
return ret;
}
+
+ /* reset ret to -1 so that we don't need to explicitly
+ * set it in all error paths before "goto err"
+ */
+ ret = -1;
+
ctx->process_uuid = generate_glusterfs_ctx_id ();
if (!ctx->process_uuid) {
gf_msg ("", GF_LOG_CRITICAL, 0, glusterfsd_msg_13);