diff options
-rw-r--r-- | tests/auto/corelib/io/qfile/BLACKLIST | 4 | ||||
-rw-r--r-- | tests/auto/corelib/io/qfile/tst_qfile.cpp | 29 |
2 files changed, 23 insertions, 10 deletions
diff --git a/tests/auto/corelib/io/qfile/BLACKLIST b/tests/auto/corelib/io/qfile/BLACKLIST index 8d636d40b8..8366667166 100644 --- a/tests/auto/corelib/io/qfile/BLACKLIST +++ b/tests/auto/corelib/io/qfile/BLACKLIST @@ -5,7 +5,3 @@ msvc-2017 ci [readLineStdin_lineByLine] msvc-2015 ci msvc-2017 ci -[openStandardStreamsFileDescriptors] -osx -[openStandardStreamsBufferedStreams] -osx diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 54d089f3bb..7bf45be58c 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -3185,22 +3185,39 @@ static qint64 streamExpectedSize(int fd) QT_STATBUF sb; if (QT_FSTAT(fd, &sb) != -1) return sb.st_size; + qErrnoWarning("Could not fstat fd %d", fd); return 0; } static qint64 streamCurrentPosition(int fd) { - QT_OFF_T pos = QT_LSEEK(fd, 0, SEEK_CUR); - if (pos != -1) - return pos; + QT_STATBUF sb; + if (QT_FSTAT(fd, &sb) != -1) { + QT_OFF_T pos = -1; + if ((sb.st_mode & QT_STAT_MASK) == QT_STAT_REG) + pos = QT_LSEEK(fd, 0, SEEK_CUR); + if (pos != -1) + return pos; + // failure to lseek() is not a problem + } else { + qErrnoWarning("Could not fstat fd %d", fd); + } return 0; } static qint64 streamCurrentPosition(FILE *f) { - QT_OFF_T pos = QT_FTELL(f); - if (pos != -1) - return pos; + QT_STATBUF sb; + if (QT_FSTAT(QT_FILENO(f), &sb) != -1) { + QT_OFF_T pos = -1; + if ((sb.st_mode & QT_STAT_MASK) == QT_STAT_REG) + pos = QT_FTELL(f); + if (pos != -1) + return pos; + // failure to ftell() is not a problem + } else { + qErrnoWarning("Could not fstat fd %d", QT_FILENO(f)); + } return 0; } |