summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfilesystemiterator_p.h
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/qfilesystemiterator_p.h
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/qfilesystemiterator_p.h')
-rw-r--r--src/corelib/io/qfilesystemiterator_p.h8
1 files changed, 0 insertions, 8 deletions
diff --git a/src/corelib/io/qfilesystemiterator_p.h b/src/corelib/io/qfilesystemiterator_p.h
index 119068a648..51dfe65f57 100644
--- a/src/corelib/io/qfilesystemiterator_p.h
+++ b/src/corelib/io/qfilesystemiterator_p.h
@@ -87,14 +87,6 @@ private:
#else
QT_DIR *dir;
QT_DIRENT *dirEntry;
-#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_CYGWIN) || defined(QT_EXT_QNX_READDIR_R)
- // for readdir_r
- QScopedPointer<QT_DIRENT, QScopedPointerPodDeleter> mt_file;
-#if defined(QT_EXT_QNX_READDIR_R)
- // for _readdir_r
- size_t direntSize;
-#endif
-#endif
int lastError;
#endif