mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-25 03:12:56 +00:00
use qt_safe_open() and qt_safe_close() directly in QFSFileEngine
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
890185b958
commit
629c57c641
1 changed files with 3 additions and 11 deletions
|
@ -104,10 +104,7 @@ QFSFileEngine::~QFSFileEngine()
|
||||||
Q_D(QFSFileEngine);
|
Q_D(QFSFileEngine);
|
||||||
if (d->closeFileHandle) {
|
if (d->closeFileHandle) {
|
||||||
if (d->fd != -1) {
|
if (d->fd != -1) {
|
||||||
int ret;
|
qt_safe_close(d->fd);
|
||||||
do {
|
|
||||||
ret = QT_CLOSE(d->fd);
|
|
||||||
} while (ret == -1 && errno == EINTR);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QList<uchar*> keys = d->maps.keys();
|
QList<uchar*> keys = d->maps.keys();
|
||||||
|
@ -170,9 +167,7 @@ bool QFSFileEngine::open(QIODevice::OpenMode openMode)
|
||||||
|
|
||||||
// Try to open the file.
|
// Try to open the file.
|
||||||
QByteArray native = d->fileEntry.nativeFilePath();
|
QByteArray native = d->fileEntry.nativeFilePath();
|
||||||
do {
|
d->fd = qt_safe_open(native.constData(), flags, 0666);
|
||||||
d->fd = QT_OPEN(native.constData(), flags, 0666);
|
|
||||||
} while (d->fd == -1 && errno == EINTR);
|
|
||||||
|
|
||||||
// On failure, return and report the error.
|
// On failure, return and report the error.
|
||||||
if (d->fd == -1) {
|
if (d->fd == -1) {
|
||||||
|
@ -293,10 +288,7 @@ bool QFSFileEngine::close()
|
||||||
|
|
||||||
// Close the file if we created the handle.
|
// Close the file if we created the handle.
|
||||||
if (d->closeFileHandle) {
|
if (d->closeFileHandle) {
|
||||||
int ret;
|
int ret = qt_safe_close(d->fd);
|
||||||
do {
|
|
||||||
ret = QT_CLOSE(d->fd);
|
|
||||||
} while (ret == -1 && errno == EINTR);
|
|
||||||
|
|
||||||
// We must reset these guys regardless; calling close again after a
|
// We must reset these guys regardless; calling close again after a
|
||||||
// failed close causes crashes on some systems.
|
// failed close causes crashes on some systems.
|
||||||
|
|
Loading…
Add table
Reference in a new issue