trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject trafficserver git commit: Fix to make us check the main_fd on both paths when opening a log file to parse.
Date Tue, 06 Jan 2015 22:53:19 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master b52fc5aa6 -> 82f95638c


Fix to make us check the main_fd on both paths when opening
a log file to parse.

Coverity CID #1200012


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/82f95638
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/82f95638
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/82f95638

Branch: refs/heads/master
Commit: 82f95638c3d3ce314d64f2ec73019d1761e2d0b2
Parents: b52fc5a
Author: Leif Hedstrom <zwoop@apache.org>
Authored: Tue Jan 6 15:52:41 2015 -0700
Committer: Leif Hedstrom <zwoop@apache.org>
Committed: Tue Jan 6 15:52:41 2015 -0700

----------------------------------------------------------------------
 proxy/logstats.cc | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/82f95638/proxy/logstats.cc
----------------------------------------------------------------------
diff --git a/proxy/logstats.cc b/proxy/logstats.cc
index 1a18375..e8bb871 100644
--- a/proxy/logstats.cc
+++ b/proxy/logstats.cc
@@ -2533,15 +2533,11 @@ main(int /* argc ATS_UNUSED */, char *argv[])
     close(main_fd);
     close(state_fd);
   } else {
-    if (cl.log_file[0] != '\0') {
-      main_fd = open(cl.log_file, O_RDONLY);
-      if (main_fd < 0) {
-        exit_status.set(EXIT_CRITICAL, " can't open log file ");
-        exit_status.append(cl.log_file);
-        my_exit(exit_status);
-      }
-    } else {
-      main_fd = open_main_log(exit_status);
+    main_fd = cl.log_file[0] ? open(cl.log_file, O_RDONLY) : open_main_log(exit_status);
+    if (main_fd < 0) {
+      exit_status.set(EXIT_CRITICAL, " can't open log file ");
+      exit_status.append(cl.log_file);
+      my_exit(exit_status);
     }
 
     if (cl.tail > 0) {


Mime
View raw message