From ca7586841e507305ebb951d604c077cf8de84920 Mon Sep 17 00:00:00 2001 From: Poornima G Date: Mon, 23 Dec 2013 05:11:15 +0000 Subject: gfapi: Closed the logfile fd and initialize to NULL in glfs_fini Backport of http://review.gluster.org/6552 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. BUG: 1030228 Change-Id: I90f7fb744b05bc6bd14c61fe143c0814896991e2 Signed-off-by: Poornima G Reviewed-on: http://review.gluster.org/6552 Reviewed-on: http://review.gluster.org/6731 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- api/src/glfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'api/src/glfs.c') 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; } -- cgit