summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorPoornima G <pgurusid@redhat.com>2013-12-23 05:11:15 +0000
committerVijay Bellur <vbellur@redhat.com>2013-12-26 03:16:30 -0800
commit0d7279d32d5f55c0210bdcfda2d3f83e35f524b6 (patch)
treea61c51916b467918de7860b74d4029d517b613ea /api
parent2ba42d07eb967472227eb0a93e4ca2cac7a197b5 (diff)
gfapi: Closed the logfile fd and initialize to NULL in glfs_fini
Currently if logfile is closed and other threads call gf_log after glfs_fini() is executed, it may lead to memory corruption. Adding gf_log_fini() which closes the logfile and initializes the logfile to NULL, thus any further logging happens to stderr. Also added gf_log_globals_fini() which should be filled in the future to release all the logging resources. Change-Id: I879163e1a3636e65300d166f782517ee773cab65 BUG: 1030228 Signed-off-by: Poornima G <pgurusid@redhat.com> Reviewed-on: http://review.gluster.org/6552 Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'api')
-rw-r--r--api/src/glfs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/api/src/glfs.c b/api/src/glfs.c
index 29ed47c0c61..1bae78d2378 100644
--- a/api/src/glfs.c
+++ b/api/src/glfs.c
@@ -666,8 +666,8 @@ glfs_fini (struct glfs *fs)
glfs_subvol_done (fs, subvol);
- if (ctx->log.logfile)
- fclose (ctx->log.logfile);
+ if (gf_log_fini(ctx) != 0)
+ ret = -1;
return ret;
}