From f4d7250ef13f19ad01776c7824c54747cbf9361f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 15 Apr 2002 19:45:20 +0000 Subject: [PATCH] fixed a few minor bugs: handle the directory parameter to Create() correctly, better error checking git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15153 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/unix/snglinst.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/unix/snglinst.cpp b/src/unix/snglinst.cpp index d29268bbd3..9cc4155e80 100644 --- a/src/unix/snglinst.cpp +++ b/src/unix/snglinst.cpp @@ -158,8 +158,7 @@ LockResult wxSingleInstanceCheckerImpl::CreateLockFile() if ( m_fdLock != -1 ) { // try to lock it - int rc = wxLockFile(m_fdLock, LOCK); - if ( rc == 0 ) + if ( wxLockFile(m_fdLock, LOCK) == 0 ) { // fine, we have the exclusive lock to the file, write our PID // into it @@ -188,7 +187,7 @@ LockResult wxSingleInstanceCheckerImpl::CreateLockFile() close(m_fdLock); m_fdLock = -1; - if ( rc != EACCES && rc != EAGAIN ) + if ( errno != EACCES && errno != EAGAIN ) { wxLogSysError(_("Failed to lock the lock file '%s'"), m_nameLock.c_str()); @@ -332,7 +331,12 @@ bool wxSingleInstanceChecker::Create(const wxString& name, wxString fullname = path; if ( fullname.empty() ) { - fullname << wxGetHomeDir() << _T('/'); + fullname = wxGetHomeDir(); + } + + if ( fullname.Last() != _T('/') ) + { + fullname += _T('/'); } fullname << name; -- 2.45.2