From 1252cc90da6156945c3636c1a2b5f702bc14fb2d Mon Sep 17 00:00:00 2001 From: Kaushal M Date: Fri, 14 Oct 2011 10:33:18 +0530 Subject: glusterd: fix '.cmd_log_history'file handle leak on SIGHUP Closes the .cmd_log_history file and reopens it to prevent leakage of file handles. Change-Id: I1c846ccf9a0c1c90c9209f26a1c5332d3dd94ffd BUG: 3678 Reviewed-on: http://review.gluster.com/584 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi --- libglusterfs/src/logging.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c index 159a21b1f..5b9c1fc4f 100644 --- a/libglusterfs/src/logging.c +++ b/libglusterfs/src/logging.c @@ -607,7 +607,11 @@ gf_cmd_log_init (const char *filename) " error\n"); return -1; } - + /* close and reopen cmdlogfile for log rotate*/ + if (cmdlogfile) { + fclose (cmdlogfile); + cmdlogfile = NULL; + } cmdlogfile = fopen (cmd_log_filename, "a"); if (!cmdlogfile){ gf_log ("glusterd", GF_LOG_CRITICAL, -- cgit