You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by du...@apache.org on 2019/03/28 19:05:33 UTC
[trafficserver] branch master updated: check return value of open
This is an automated email from the ASF dual-hosted git repository.
duke8253 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 f7865e9 check return value of open
f7865e9 is described below
commit f7865e98926c824e8ab2517ad3e1aebd0efa7d18
Author: Fei Deng <du...@gmail.com>
AuthorDate: Thu Mar 28 09:59:14 2019 -0500
check return value of open
---
plugins/experimental/ssl_session_reuse/src/config.cc | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/plugins/experimental/ssl_session_reuse/src/config.cc b/plugins/experimental/ssl_session_reuse/src/config.cc
index a2d9457..9c3caf0 100644
--- a/plugins/experimental/ssl_session_reuse/src/config.cc
+++ b/plugins/experimental/ssl_session_reuse/src/config.cc
@@ -56,13 +56,13 @@ Config::loadConfig(const std::string &filename)
m_filename = filename;
- int fd = (this->m_filename.length() > 0 ? open(m_filename.c_str(), O_RDONLY) : 0);
+ int fd = (this->m_filename.length() > 0 ? open(m_filename.c_str(), O_RDONLY) : ts::NO_FD);
struct stat info;
- if (0 == fstat(fd, &info)) {
+ if (fd > 0 && 0 == fstat(fd, &info)) {
size_t n = info.st_size;
std::string config_data;
config_data.resize(n);
- if (read(fd, const_cast<char *>(config_data.data()), n) < 0) {
+ if (read(fd, const_cast<char *>(config_data.data()), n) != n) {
close(fd);
return success;
}