From ba593511ba9c0711b6b19e1b24112a7a207e74fc Mon Sep 17 00:00:00 2001 From: Pavel Moravec Date: Tue, 18 Nov 2014 15:01:31 +0000 Subject: QPID-6232: [C++ broker] Linearstore segfaults when ulimit prevents creating new file in EFP git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1640357 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/linearstore/journal/EmptyFilePool.cpp | 4 +++- qpid/cpp/src/qpid/linearstore/journal/jerrno.cpp | 2 ++ qpid/cpp/src/qpid/linearstore/journal/jerrno.h | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) (limited to 'qpid/cpp') diff --git a/qpid/cpp/src/qpid/linearstore/journal/EmptyFilePool.cpp b/qpid/cpp/src/qpid/linearstore/journal/EmptyFilePool.cpp index cc54191c98..18f4d3afc3 100644 --- a/qpid/cpp/src/qpid/linearstore/journal/EmptyFilePool.cpp +++ b/qpid/cpp/src/qpid/linearstore/journal/EmptyFilePool.cpp @@ -239,7 +239,9 @@ bool EmptyFilePool::overwriteFileContents(const std::string& fqFileName) { return true; //std::cout << "*** WARNING: EFP " << efpDirectory_ << " is empty - created new journal file " << fqFileName.substr(fqFileName.rfind('/') + 1) << " on the fly" << std::endl; // DEBUG } else { -//std::cerr << "*** ERROR: Unable to open file \"" << fqFileName << "\"" << std::endl; // DEBUG + std::ostringstream oss; + oss << "std::ofstream ofs: file=\"" << fqFileName.c_str() << "\"" << " failed to be open"; + throw jexception(jerrno::JERR_EFP_FOPEN, oss.str(), "EmptyFilePool", "overwriteFileContents"); } return false; } diff --git a/qpid/cpp/src/qpid/linearstore/journal/jerrno.cpp b/qpid/cpp/src/qpid/linearstore/journal/jerrno.cpp index 2d0f0c2f94..9d59039220 100644 --- a/qpid/cpp/src/qpid/linearstore/journal/jerrno.cpp +++ b/qpid/cpp/src/qpid/linearstore/journal/jerrno.cpp @@ -115,6 +115,7 @@ const uint32_t jerrno::JERR_EFP_EMPTY = 0x0d05; const uint32_t jerrno::JERR_EFP_SYMLINK = 0x0d06; const uint32_t jerrno::JERR_EFP_LSTAT = 0x0d07; const uint32_t jerrno::JERR_EFP_BADFILETYPE = 0x0d08; +const uint32_t jerrno::JERR_EFP_FOPEN = 0x0d09; // Negative returns for some functions const int32_t jerrno::AIO_TIMEOUT = -1; @@ -212,6 +213,7 @@ jerrno::__init() _err_map[JERR_EFP_SYMLINK] = "JERR_EFP_SYMLINK: Symbolic link operation failed"; _err_map[JERR_EFP_LSTAT] = "JERR_EFP_LSTAT: lstat() operation failed"; _err_map[JERR_EFP_BADFILETYPE] = "JERR_EFP_BADFILETYPE: File type incorrect for operation"; + _err_map[JERR_EFP_FOPEN] = "JERR_EFP_FOPEN: Unable to fopen file for write"; //_err_map[] = ""; diff --git a/qpid/cpp/src/qpid/linearstore/journal/jerrno.h b/qpid/cpp/src/qpid/linearstore/journal/jerrno.h index 104618efaa..77b18b17e8 100644 --- a/qpid/cpp/src/qpid/linearstore/journal/jerrno.h +++ b/qpid/cpp/src/qpid/linearstore/journal/jerrno.h @@ -133,6 +133,7 @@ namespace journal { static const uint32_t JERR_EFP_SYMLINK; ///< Symbolic Link operation failed static const uint32_t JERR_EFP_LSTAT; ///< lstat operation failed static const uint32_t JERR_EFP_BADFILETYPE; ///< Bad file type + static const uint32_t JERR_EFP_FOPEN; ///< Unable to fopen file for write // Negative returns for some functions static const int32_t AIO_TIMEOUT; ///< Timeout waiting for AIO return -- cgit v1.2.1