mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-27 19:10:20 +01:00
use non-zero project ID ('p') for ftok()
This commit is contained in:
@@ -65,7 +65,7 @@ NamedEventImpl::NamedEventImpl(const std::string& name):
|
|||||||
close(fd);
|
close(fd);
|
||||||
else
|
else
|
||||||
throw SystemException(Poco::format("cannot create named event %s (lockfile)", fileName), _name);
|
throw SystemException(Poco::format("cannot create named event %s (lockfile)", fileName), _name);
|
||||||
key_t key = ftok(fileName.c_str(), 0);
|
key_t key = ftok(fileName.c_str(), 'p');
|
||||||
if (key == -1)
|
if (key == -1)
|
||||||
throw SystemException(Poco::format("cannot create named mutex %s (ftok() failed, errno=%d)", fileName, errno), _name);
|
throw SystemException(Poco::format("cannot create named mutex %s (ftok() failed, errno=%d)", fileName, errno), _name);
|
||||||
_semid = semget(key, 1, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH | IPC_CREAT | IPC_EXCL);
|
_semid = semget(key, 1, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH | IPC_CREAT | IPC_EXCL);
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ NamedMutexImpl::NamedMutexImpl(const std::string& name):
|
|||||||
close(fd);
|
close(fd);
|
||||||
else
|
else
|
||||||
throw SystemException(Poco::format("cannot create named mutex %s (lockfile)", fileName), _name);
|
throw SystemException(Poco::format("cannot create named mutex %s (lockfile)", fileName), _name);
|
||||||
key_t key = ftok(fileName.c_str(), 0);
|
key_t key = ftok(fileName.c_str(), 'p');
|
||||||
if (key == -1)
|
if (key == -1)
|
||||||
throw SystemException(Poco::format("cannot create named mutex %s (ftok() failed, errno=%d)", fileName, errno), _name);
|
throw SystemException(Poco::format("cannot create named mutex %s (ftok() failed, errno=%d)", fileName, errno), _name);
|
||||||
_semid = semget(key, 1, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH | IPC_CREAT | IPC_EXCL);
|
_semid = semget(key, 1, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH | IPC_CREAT | IPC_EXCL);
|
||||||
|
|||||||
Reference in New Issue
Block a user