Merge branch 'poco-1.7.9' into poco-1.8.0

This commit is contained in:
Günter Obiltschnig
2017-09-11 21:08:04 +02:00
4 changed files with 17 additions and 9 deletions

View File

@@ -25,6 +25,10 @@ Release 1.7.9 (2017-09-11)
statements, e.g. writing empty strings. statements, e.g. writing empty strings.
- added POCO_DEPRECATED macro which will be used in the future to deprecate - added POCO_DEPRECATED macro which will be used in the future to deprecate
classes and methods. classes and methods.
- Poco::NamedMutex and Poco::NamedEvent (System V Semaphores implementation): files are
now opened with O_RDONLY | O_CREAT instead of O_WRONLY | O_CREAT, allowing sharing
between different users. Furthermore, ftok() is called with 'p' as project ID
argument.
Release 1.7.8p3 (2017-06-22) Release 1.7.8p3 (2017-06-22)

View File

@@ -55,15 +55,15 @@ NamedEventImpl::NamedEventImpl(const std::string& name):
std::string fileName = getFileName(); std::string fileName = getFileName();
#if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX__) || defined(_AIX) #if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX__) || defined(_AIX)
_sem = sem_open(fileName.c_str(), O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO, 0); _sem = sem_open(fileName.c_str(), O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO, 0);
if ((long) _sem == (long) SEM_FAILED) if ((long) _sem == (long) SEM_FAILED)
throw SystemException(Poco::format("cannot create named mutex %s (sem_open() failed, errno=%d)", fileName, errno), _name); throw SystemException(Poco::format("cannot create named mutex %s (sem_open() failed, errno=%d)", fileName, errno), _name);
#else #else
int fd = open(fileName.c_str(), O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); int fd = open(fileName.c_str(), O_RDONLY | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if (fd != -1) if (fd != -1)
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);
@@ -126,7 +126,7 @@ void NamedEventImpl::waitImpl()
{ {
err = semop(_semid, &op, 1); err = semop(_semid, &op, 1);
} }
while (err && errno == EINTR); while (err && errno == EINTR);
if (err) throw SystemException("cannot wait for named event", _name); if (err) throw SystemException("cannot wait for named event", _name);
#endif #endif
} }

View File

@@ -55,15 +55,15 @@ NamedMutexImpl::NamedMutexImpl(const std::string& name):
std::string fileName = getFileName(); std::string fileName = getFileName();
#if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX__) || defined(_AIX) #if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX__) || defined(_AIX)
_sem = sem_open(fileName.c_str(), O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO, 1); _sem = sem_open(fileName.c_str(), O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO, 1);
if ((long) _sem == (long) SEM_FAILED) if ((long) _sem == (long) SEM_FAILED)
throw SystemException(Poco::format("cannot create named mutex %s (sem_open() failed, errno=%d)", fileName, errno), _name); throw SystemException(Poco::format("cannot create named mutex %s (sem_open() failed, errno=%d)", fileName, errno), _name);
#else #else
int fd = open(fileName.c_str(), O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); int fd = open(fileName.c_str(), O_RDONLY | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if (fd != -1) if (fd != -1)
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);

View File

@@ -26,6 +26,10 @@ AAAIntroduction
statements, e.g. writing empty strings. statements, e.g. writing empty strings.
- added POCO_DEPRECATED macro which will be used in the future to deprecate - added POCO_DEPRECATED macro which will be used in the future to deprecate
classes and methods. classes and methods.
- Poco::NamedMutex and Poco::NamedEvent (System V Semaphores implementation): files are
now opened with O_RDONLY | O_CREAT instead of O_WRONLY | O_CREAT, allowing sharing
between different users. Furthermore, ftok() is called with 'p' as project ID
argument.
!!!Release 1.7.8p3 !!!Release 1.7.8p3