Fix permissions on lock files on Unix
We should create the files with 0666 and let the umask take care of adjusting to the final permissions in the file system. [ChangeLog][QtCore][QLockFile] Fixed permissions on lock files on Unix to allow for adjustments via umask. Change-Id: Iee6a6ac3920d0ffd4465f54ac6e955f7fe087173 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
parent
4e6440acf8
commit
131b7c8f64
@ -176,7 +176,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys()
|
||||
% localHostName() % '\n';
|
||||
|
||||
const QByteArray lockFileName = QFile::encodeName(fileName);
|
||||
const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY | O_CREAT | O_EXCL, 0644);
|
||||
const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY | O_CREAT | O_EXCL, 0666);
|
||||
if (fd < 0) {
|
||||
switch (errno) {
|
||||
case EEXIST:
|
||||
@ -217,7 +217,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys()
|
||||
bool QLockFilePrivate::removeStaleLock()
|
||||
{
|
||||
const QByteArray lockFileName = QFile::encodeName(fileName);
|
||||
const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY, 0644);
|
||||
const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY, 0666);
|
||||
if (fd < 0) // gone already?
|
||||
return false;
|
||||
bool success = setNativeLocks(fileName, fd) && (::unlink(lockFileName) == 0);
|
||||
|
Loading…
Reference in New Issue
Block a user