From c555679d4fbb260cef484c667d134fdf4d457bcd Mon Sep 17 00:00:00 2001 From: Michal Vala Date: Wed, 2 May 2018 19:24:52 -0400 Subject: [PATCH] 8179887: Build failure with glibc >= 2.24: error: 'int readdir_r(DIR*, dirent*, dirent**)' is deprecated Use readir rather than readdir_r on Linux. Reviewed-by: kbarrett, stuefe, andrew --- src/hotspot/os/linux/os_linux.inline.hpp | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/src/hotspot/os/linux/os_linux.inline.hpp b/src/hotspot/os/linux/os_linux.inline.hpp index cf00c6a4621..8b5824c8944 100644 --- a/src/hotspot/os/linux/os_linux.inline.hpp +++ b/src/hotspot/os/linux/os_linux.inline.hpp @@ -98,26 +98,8 @@ inline int os::ftruncate(int fd, jlong length) { inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf) { -// readdir_r has been deprecated since glibc 2.24. -// See https://sourceware.org/bugzilla/show_bug.cgi?id=19056 for more details. -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - - dirent* p; - int status; assert(dirp != NULL, "just checking"); - - // NOTE: Linux readdir_r (on RH 6.2 and 7.2 at least) is NOT like the POSIX - // version. Here is the doc for this function: - // http://www.gnu.org/manual/glibc-2.2.3/html_node/libc_262.html - - if((status = ::readdir_r(dirp, dbuf, &p)) != 0) { - errno = status; - return NULL; - } else - return p; - -#pragma GCC diagnostic pop + return ::readdir(dirp); } inline int os::closedir(DIR *dirp) {