summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfilesystemengine.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2016-09-15 14:07:59 -0700
committerThiago Macieira <thiago.macieira@intel.com>2016-11-03 15:31:33 +0000
commit4b6784b49c6dcf0add9ec0cbb4ad97cd191c2aa3 (patch)
treef02a543bcdc93c87d5956d86ead6c2c164d10ae8 /src/corelib/io/qfilesystemengine.cpp
parentcf4e7575cad8975442191160723d766b48a9623f (diff)
Stop using readdir_r: glibc deprecated it and it's not a good idea
POSIX does not require that readdir() be reentrant even for operations on different dirent objects, but all implementations (according to the glibc documentation) already do that. Moreover, it's not a good idea to use readdir_r since the buffer space is limited by the caller, so certain file names may be too long (ENAMETOOLONG) -- we had a workaround for QNX, but for no other OS. According to the glibc documentation, it is expected that POSIX will mark readdir_r obsolete and instead require some form of reentrancy for readdir. This commit makes everyone use readdir instead. The macros in qplatformdefs.h are left behind in case someone else is using them. With glibc 2.24, we started getting: qplatformdefs.h:150:35: warning: ‘int readdir_r(DIR*, dirent*, dirent**)’ is deprecated [-Wdeprecated-declarations] qfilesystemiterator_unix.cpp:112:17: note: in expansion of macro ‘QT_READDIR_R’ Task-number: QTBUG-56088 Change-Id: I33dc971f005a4848bb8ffffd14749b4082f62e69 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
Diffstat (limited to 'src/corelib/io/qfilesystemengine.cpp')
-rw-r--r--src/corelib/io/qfilesystemengine.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/io/qfilesystemengine.cpp b/src/corelib/io/qfilesystemengine.cpp
index 02aa2ff4b7..055ff3600b 100644
--- a/src/corelib/io/qfilesystemengine.cpp
+++ b/src/corelib/io/qfilesystemengine.cpp
@@ -216,7 +216,7 @@ bool QFileSystemEngine::fillMetaData(int fd, QFileSystemMetaData &data)
return false;
}
-#if defined(QT_EXT_QNX_READDIR_R)
+#if defined(_DEXTRA_FIRST)
static void fillStat64fromStat32(struct stat64 *statBuf64, const struct stat &statBuf32)
{
statBuf64->st_mode = statBuf32.st_mode;
@@ -281,7 +281,7 @@ void QFileSystemMetaData::fillFromStatBuf(const QT_STATBUF &statBuffer)
void QFileSystemMetaData::fillFromDirEnt(const QT_DIRENT &entry)
{
-#if defined(QT_EXT_QNX_READDIR_R)
+#if defined(_DEXTRA_FIRST)
knownFlagsMask = 0;
entryFlags = 0;
for (dirent_extra *extra = _DEXTRA_FIRST(&entry); _DEXTRA_VALID(extra, &entry);