diff options
author | Raghavendra Bhat <raghavendra@redhat.com> | 2012-11-22 18:48:40 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-12-04 16:28:03 -0800 |
commit | ee2813f440e9b6874eed93de307b8070c8953d5b (patch) | |
tree | 7e8f87484af2f954b1c24f23eee899e3a622b054 /libglusterfs | |
parent | 6d1607becc4fd84f7422730f37582164c86127d2 (diff) |
rpc: check the ctx->listener before accessing rpcsvc object
Change-Id: I3c913d1fab07deb41eec05c5adc29a3964315b43
BUG: 858487
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.org/4230
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/common-utils.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 6e94169de2b..40a68795302 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) |