Repository: trafficserver Updated Branches: refs/heads/master 5edd58cd8 -> b29149c28
TS-4000: Extraneous `setvbuf()` in Diags.cc Remove the extra `setvbuf()` because `setlinebuf()` is called in `BaseLogFile::open_file()` right beforehand. This closes #325. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/b29149c2 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/b29149c2 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/b29149c2 Branch: refs/heads/master Commit: b29149c28b7d78b82bfdeaa1db71fb17236b6415 Parents: 5edd58c Author: Daniel Xu <[email protected]> Authored: Fri Nov 6 21:14:30 2015 +0000 Committer: James Peach <[email protected]> Committed: Fri Nov 6 15:03:19 2015 -0800 ---------------------------------------------------------------------- lib/ts/Diags.cc | 28 ++++++++++------------------ proxy/shared/DiagsConfig.cc | 2 +- 2 files changed, 11 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b29149c2/lib/ts/Diags.cc ---------------------------------------------------------------------- diff --git a/lib/ts/Diags.cc b/lib/ts/Diags.cc index bc5d0d8..0bd47ea 100644 --- a/lib/ts/Diags.cc +++ b/lib/ts/Diags.cc @@ -116,7 +116,8 @@ SrcLoc::str(char *buf, int buflen) const ////////////////////////////////////////////////////////////////////////////// Diags::Diags(const char *bdt, const char *bat, BaseLogFile *_diags_log) - : stdout_log(NULL), stderr_log(NULL), magic(DIAGS_MAGIC), show_location(0), base_debug_tags(NULL), base_action_tags(NULL) + : diags_log(NULL), stdout_log(NULL), stderr_log(NULL), magic(DIAGS_MAGIC), show_location(0), base_debug_tags(NULL), + base_action_tags(NULL) { int i; @@ -585,25 +586,16 @@ Diags::error_va(DiagsLevel level, const char *file, const char *func, const int void Diags::setup_diagslog(BaseLogFile *blf) { - diags_log = blf; - if (!diags_log) - return; + ink_assert(diags_log == NULL); - // get file stream from BaseLogFile filedes - if (blf->open_file() == BaseLogFile::LOG_FILE_NO_ERROR) { - if (blf->m_fp) { - int status; - status = setvbuf(blf->m_fp, NULL, _IOLBF, 512); - if (status != 0) { - log_log_error("Could not setvbuf() for %s\n", blf->get_name()); - blf->close_file(); - delete blf; - diags_log = NULL; - } - } else { - log_log_error("Could not open diags log file: %s\n", strerror(errno)); - } + if (blf != NULL && blf->open_file() != BaseLogFile::LOG_FILE_NO_ERROR) { + delete blf; + + log_log_error("Could not open diags log file: %s\n", strerror(errno)); + return; } + + diags_log = blf; log_log_trace("Exiting setup_diagslog, name=%s, this=%p\n", blf->get_name(), this); } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b29149c2/proxy/shared/DiagsConfig.cc ---------------------------------------------------------------------- diff --git a/proxy/shared/DiagsConfig.cc b/proxy/shared/DiagsConfig.cc index 9219ce4..e305c1f 100644 --- a/proxy/shared/DiagsConfig.cc +++ b/proxy/shared/DiagsConfig.cc @@ -281,7 +281,7 @@ DiagsConfig::DiagsConfig(const char *filename, const char *tags, const char *act //////////////////////////////////////////////////////////////////// if (!use_records) { - diags = new Diags(tags, actions, diags_log); + diags = new Diags(tags, actions, NULL); config_diags_norecords(); return; }
