You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by pm...@apache.org on 2014/01/17 13:32:30 UTC

svn commit: r1559090 - /qpid/trunk/qpid/cpp/src/qpid/sys/posix/MemoryMappedFile.cpp

Author: pmoravec
Date: Fri Jan 17 12:32:29 2014
New Revision: 1559090

URL: http://svn.apache.org/r1559090
Log:
QPID-5486: Creating paged queue can overwrite existing qpidd files

Modified:
    qpid/trunk/qpid/cpp/src/qpid/sys/posix/MemoryMappedFile.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/sys/posix/MemoryMappedFile.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/sys/posix/MemoryMappedFile.cpp?rev=1559090&r1=1559089&r2=1559090&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/sys/posix/MemoryMappedFile.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/sys/posix/MemoryMappedFile.cpp Fri Jan 17 12:32:29 2014
@@ -65,8 +65,7 @@ std::string MemoryMappedFile::open(const
 {
     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;



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org