summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorPavel Moravec <pmoravec@apache.org>2014-01-17 12:32:29 +0000
committerPavel Moravec <pmoravec@apache.org>2014-01-17 12:32:29 +0000
commit88a8ed7c656e5863c638b2189294e19a22a6118c (patch)
treea4bfad0fe8dea475a940fb1ecdb603831822039f /cpp/src
parent4c6939b574e30a3dd6e9e7277086532b3aa6e5f8 (diff)
downloadqpid-python-88a8ed7c656e5863c638b2189294e19a22a6118c.tar.gz
QPID-5486: Creating paged queue can overwrite existing qpidd files
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1559090 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/sys/posix/MemoryMappedFile.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/cpp/src/qpid/sys/posix/MemoryMappedFile.cpp b/cpp/src/qpid/sys/posix/MemoryMappedFile.cpp
index 9a406fe03f..f647ab3943 100644
--- a/cpp/src/qpid/sys/posix/MemoryMappedFile.cpp
+++ b/cpp/src/qpid/sys/posix/MemoryMappedFile.cpp
@@ -65,8 +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 flags = O_CREAT | O_EXCL | 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 << "]"));
state->fd = fd;