summaryrefslogtreecommitdiff
path: root/lib/common/NamedLock.cpp
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2009-06-28 19:05:07 +0000
committerChris Wilson <chris+github@qwirx.com>2009-06-28 19:05:07 +0000
commitd1b2c8c01e482db81d071d14b65a2542f92ea59c (patch)
treef22f448bae8b795fe8c407b1a7426f7d77c5ee60 /lib/common/NamedLock.cpp
parent95433c3e00a790d6c16c8da5171b354e9497b5ef (diff)
Make NamedLock take a std::string instead of a char pointer for C++
style.
Diffstat (limited to 'lib/common/NamedLock.cpp')
-rw-r--r--lib/common/NamedLock.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/common/NamedLock.cpp b/lib/common/NamedLock.cpp
index b3d0009b..f96f80b5 100644
--- a/lib/common/NamedLock.cpp
+++ b/lib/common/NamedLock.cpp
@@ -65,7 +65,7 @@ NamedLock::~NamedLock()
// Created: 2003/08/28
//
// --------------------------------------------------------------------------
-bool NamedLock::TryAndGetLock(const char *Filename, int mode)
+bool NamedLock::TryAndGetLock(const std::string& rFilename, int mode)
{
// Check
if(mFileDescriptor != -1)
@@ -75,7 +75,8 @@ bool NamedLock::TryAndGetLock(const char *Filename, int mode)
// See if the lock can be got
#if HAVE_DECL_O_EXLOCK
- int fd = ::open(Filename, O_WRONLY | O_NONBLOCK | O_CREAT | O_TRUNC | O_EXLOCK, mode);
+ int fd = ::open(rFilename.c_str(),
+ O_WRONLY | O_NONBLOCK | O_CREAT | O_TRUNC | O_EXLOCK, mode);
if(fd != -1)
{
// Got a lock, lovely
@@ -92,10 +93,10 @@ bool NamedLock::TryAndGetLock(const char *Filename, int mode)
return false;
#else
- int fd = ::open(Filename, O_WRONLY | O_CREAT | O_TRUNC, mode);
+ int fd = ::open(rFilename.c_str(), O_WRONLY | O_CREAT | O_TRUNC, mode);
if(fd == -1)
{
- BOX_WARNING("Failed to open lockfile: " << Filename);
+ BOX_WARNING("Failed to open lockfile: " << rFilename);
THROW_EXCEPTION(CommonException, OSFileError)
}