This is an automated email from the ASF dual-hosted git repository.

shinrich pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 176cb8e  check return value
176cb8e is described below

commit 176cb8e552139d879c70711a47911b49af4565cd
Author: Fei Deng <[email protected]>
AuthorDate: Thu Mar 21 13:43:47 2019 -0500

    check return value
---
 plugins/experimental/ssl_session_reuse/src/config.cc | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/plugins/experimental/ssl_session_reuse/src/config.cc 
b/plugins/experimental/ssl_session_reuse/src/config.cc
index 48e2982..a2d9457 100644
--- a/plugins/experimental/ssl_session_reuse/src/config.cc
+++ b/plugins/experimental/ssl_session_reuse/src/config.cc
@@ -62,7 +62,10 @@ Config::loadConfig(const std::string &filename)
     size_t n = info.st_size;
     std::string config_data;
     config_data.resize(n);
-    read(fd, const_cast<char *>(config_data.data()), n);
+    if (read(fd, const_cast<char *>(config_data.data()), n) < 0) {
+      close(fd);
+      return success;
+    }
 
     ts::TextView content(config_data);
     while (content) {
@@ -77,10 +80,13 @@ Config::loadConfig(const std::string &filename)
         m_config[std::string(field.data(), field.size())] = 
std::string(line.data(), line.size());
       }
     }
+
+    close(fd);
+
+    m_noConfig      = false;
+    success         = true;
+    m_alreadyLoaded = true;
   }
-  m_noConfig      = false;
-  success         = true;
-  m_alreadyLoaded = true;
 
   return success;
 }

Reply via email to