From 45e531236a956b2f72fbec98bc19031edb0bab65 Mon Sep 17 00:00:00 2001 From: Wenfeng Liu Date: Thu, 24 May 2018 01:10:01 +0000 Subject: [PATCH] Return false in SharedFiles::open() when an error happens --- src/utils/shared_files.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/shared_files.cc b/src/utils/shared_files.cc index 886ea4a9..4830d1bd 100644 --- a/src/utils/shared_files.cc +++ b/src/utils/shared_files.cc @@ -127,6 +127,7 @@ err_fh: bool SharedFiles::open(const std::string& fileName, std::string *error) { std::pair a; + bool ret = true; #if MODSEC_USE_GENERAL_LOCK pthread_mutex_lock(m_generalLock); @@ -136,11 +137,13 @@ bool SharedFiles::open(const std::string& fileName, std::string *error) { if (a.first == NULL) { a = add_new_handler(fileName, error); if (error->size() > 0) { + ret = false; goto out; } } if (a.first == NULL) { error->assign("Not able to open: " + fileName); + ret = false; goto out; } @@ -149,7 +152,7 @@ out: pthread_mutex_unlock(m_generalLock); #endif - return true; + return ret; }