From ee2813f440e9b6874eed93de307b8070c8953d5b Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Thu, 22 Nov 2012 18:48:40 +0530 Subject: rpc: check the ctx->listener before accessing rpcsvc object Change-Id: I3c913d1fab07deb41eec05c5adc29a3964315b43 BUG: 858487 Signed-off-by: Raghavendra Bhat Reviewed-on: http://review.gluster.org/4230 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- libglusterfs/src/common-utils.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libglusterfs/src/common-utils.c') diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 6e94169de..40a687953 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -407,6 +407,14 @@ gf_print_trace (int32_t signum, glusterfs_ctx_t *ctx) fd = fileno (ctx->log.gf_log_logfile); + /* Now every gf_log call will just write to a buffer and when the + * buffer becomes full, its written to the log-file. Suppose the process + * crashes and prints the backtrace in the log-file, then the previous + * log information will still be in the buffer itself. So flush the + * contents of the buffer to the log file before printing the backtrace + * which helps in debugging. + */ + fflush (ctx->log.gf_log_logfile); /* Pending frames, (if any), list them in order */ ret = write (fd, "pending frames:\n", 16); if (ret < 0) -- cgit