diff options
author | Kaushal M <kaushal@gluster.com> | 2011-10-14 10:33:18 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2011-10-28 05:03:18 -0700 |
commit | 1252cc90da6156945c3636c1a2b5f702bc14fb2d (patch) | |
tree | eaece100ea604fa6e82e3b4545c7dfe0d04c0f65 /libglusterfs/src/logging.c | |
parent | 1e6780efd7320250a213eca25ee85bbf217825c4 (diff) |
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 <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amar@gluster.com>
Diffstat (limited to 'libglusterfs/src/logging.c')
-rw-r--r-- | libglusterfs/src/logging.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c index 159a21b1f61..5b9c1fc4f74 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, |