forked from qt-creator/qt-creator
QmlPuppet: Check return value of fstat
Change-Id: I2b7c04712a883455d8a5a0daa1225c2ef84a0748 Reviewed-by: Marco Bubke <marco.bubke@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -388,7 +388,8 @@ bool SharedMemory::createInternal(QSharedMemory::AccessMode mode, int size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct stat statBuffer;
|
struct stat statBuffer;
|
||||||
fstat(m_fileHandle, &statBuffer);
|
if (fstat(m_fileHandle, &statBuffer) == -1)
|
||||||
|
return false;
|
||||||
int fileSize = statBuffer.st_size;
|
int fileSize = statBuffer.st_size;
|
||||||
|
|
||||||
if (fileSize < size) {
|
if (fileSize < size) {
|
||||||
@@ -457,7 +458,8 @@ bool SharedMemory::attachInternal(QSharedMemory::AccessMode mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct stat statBuffer;
|
struct stat statBuffer;
|
||||||
fstat(m_fileHandle, &statBuffer);
|
if (fstat(m_fileHandle, &statBuffer) == -1)
|
||||||
|
return false;
|
||||||
int size = statBuffer.st_size;
|
int size = statBuffer.st_size;
|
||||||
|
|
||||||
int protection = mode == QSharedMemory::ReadOnly ? PROT_READ : PROT_WRITE;
|
int protection = mode == QSharedMemory::ReadOnly ? PROT_READ : PROT_WRITE;
|
||||||
|
Reference in New Issue
Block a user