When the file could not be accessed, we should return 0 for the size

Some functions rely on the size to be sure that the file can be read
from. Therefore when nativeSize() fails to access the file we should
return 0 instead of a random size to prevent these functions from
acting as if there is a valid file to read from.

Task-number: QTBUG-31571

Change-Id: I589fc199760ba40ef2e63047b2f226cb196f7e56
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Janne Anttila <janne.anttila@digia.com>
This commit is contained in:
Andy Shaw 2013-06-10 21:56:30 +02:00 committed by The Qt Project
parent 809bd1db8c
commit 01b6eea415

View File

@ -255,6 +255,7 @@ qint64 QFSFileEnginePrivate::nativeSize() const
if (!filled) {
thatQ->setError(QFile::UnspecifiedError, qt_error_string(errno));
return 0;
}
return metaData.size();
}