diff options
| author | Pavel Moravec <pmoravec@apache.org> | 2014-01-16 14:19:39 +0000 |
|---|---|---|
| committer | Pavel Moravec <pmoravec@apache.org> | 2014-01-16 14:19:39 +0000 |
| commit | 8eaed7bfcaaa1900e5dd571a071b19e22d423616 (patch) | |
| tree | abb1023a26fc5b17dee57a921fc2f2a35407e0d4 /cpp/src/qpid/sys | |
| parent | ac600277d5349b2f82518031310e0b9c7f4c6782 (diff) | |
| download | qpid-python-8eaed7bfcaaa1900e5dd571a071b19e22d423616.tar.gz | |
QPID-5486 Creating paged queue can overwrite existing qpidd files
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1558806 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/sys')
| -rw-r--r-- | cpp/src/qpid/sys/posix/MemoryMappedFile.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/cpp/src/qpid/sys/posix/MemoryMappedFile.cpp b/cpp/src/qpid/sys/posix/MemoryMappedFile.cpp index 477ace5451..9a406fe03f 100644 --- a/cpp/src/qpid/sys/posix/MemoryMappedFile.cpp +++ b/cpp/src/qpid/sys/posix/MemoryMappedFile.cpp @@ -65,6 +65,7 @@ std::string MemoryMappedFile::open(const std::string& name, const std::string& d { std::string path = getFileName(name, directory); + if (access(path.c_str(), F_OK) != -1) throw qpid::Exception(QPID_MSG("Attempting to re-write file " << path << " for paged queue \"" << name << "\"")); int flags = O_CREAT | O_TRUNC | O_RDWR; int fd = ::open(path.c_str(), flags, S_IRUSR | S_IWUSR); if (fd == -1) throw qpid::Exception(QPID_MSG("Failed to open memory mapped file " << path << ": " << qpid::sys::strError(errno) << " [flags=" << flags << "]")); |
