summaryrefslogtreecommitdiff
path: root/qpid/cpp/src
diff options
context:
space:
mode:
authorPavel Moravec <pmoravec@apache.org>2014-11-18 15:01:31 +0000
committerPavel Moravec <pmoravec@apache.org>2014-11-18 15:01:31 +0000
commitba593511ba9c0711b6b19e1b24112a7a207e74fc (patch)
tree44db4104d021d5fc19ba30dc34e5567c4a62aa2f /qpid/cpp/src
parent29764b2b86e07812abe0ae10966dc359b2a92b5e (diff)
downloadqpid-python-ba593511ba9c0711b6b19e1b24112a7a207e74fc.tar.gz
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
Diffstat (limited to 'qpid/cpp/src')
-rw-r--r--qpid/cpp/src/qpid/linearstore/journal/EmptyFilePool.cpp4
-rw-r--r--qpid/cpp/src/qpid/linearstore/journal/jerrno.cpp2
-rw-r--r--qpid/cpp/src/qpid/linearstore/journal/jerrno.h1
3 files changed, 6 insertions, 1 deletions
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