Check if the file is writable even while QT_BOOTSTRAPPED

QConfFile::isWritable() has the extra effect that it will try and
create the path where the file should be if it does not already
exist. So this cannot be omitted as 'qmake -set' may be used in a
situation where the path does not yet exist.

Change-Id: I0113644259f78d090a0687c44cf60d400be9c859
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This commit is contained in:
Andy Shaw 2015-12-10 11:37:59 +01:00 committed by Andy Shaw
parent faf4865b80
commit 1440c13c8c

View File

@ -1383,13 +1383,17 @@ void QConfFileSettingsPrivate::syncConfFile(int confFileNo)
Concurrent read and write are not a problem because the writing operation is atomic.
*/
QLockFile lockFile(confFile->name + QLatin1String(".lock"));
#endif
if (!readOnly) {
if (!confFile->isWritable() || !lockFile.lock() ) {
if (!confFile->isWritable()
#ifndef QT_BOOTSTRAPPED
|| !lockFile.lock()
#endif
) {
setStatus(QSettings::AccessError);
return;
}
}
#endif
/*
We hold the lock. Let's reread the file if it has changed