diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index 1ae182a4c1..e198cd6d75 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -168,10 +168,7 @@ QFSFileEngine::~QFSFileEngine() Q_D(QFSFileEngine); if (d->closeFileHandle) { if (d->fh) { - int ret; - do { - ret = fclose(d->fh); - } while (ret == EOF && errno == EINTR); + fclose(d->fh); } else if (d->fd != -1) { int ret; do { @@ -375,15 +372,14 @@ bool QFSFileEnginePrivate::closeFdFh() // Close the file if we created the handle. if (closeFileHandle) { int ret; - do { - if (fh) { - // Close buffered file. - ret = fclose(fh) != 0 ? -1 : 0; - } else { - // Close unbuffered file. - ret = QT_CLOSE(fd); - } - } while (ret == -1 && errno == EINTR); + + if (fh) { + // Close buffered file. + ret = fclose(fh); + } else { + // Close unbuffered file. + EINTR_LOOP(ret, QT_CLOSE(fd)); + } // We must reset these guys regardless; calling close again after a // failed close causes crashes on some systems.