From 4bb53fcd55764e687d1563f70bc7b0e3e1bee7ec Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Sun, 11 Jan 2026 22:18:35 +0200 Subject: [PATCH] Be prepared for a case-insensitive file system on Linux, too, not just macOS Can easily happen at least on WSL. Also avoid warnings about the deprecated readdir_r(). In current POSIX, readdir() is required to be thread-safe. (It might well have been for a long time in those POSIXish platforms we care for, I don't know.) Change-Id: I2b89b7aa170f661365580979d151c1b0557955fd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197053 Tested-by: Jenkins Reviewed-by: Tor Lillqvist Reviewed-by: Stephan Bergmann (cherry picked from commit fa8e80f06558db9e74dc318f40fb599f7bae300b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206957 Reviewed-by: Christian Lohmaier Reviewed-by: Patrick Luby --- unoidl/source/sourcetreeprovider.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/unoidl/source/sourcetreeprovider.cxx b/unoidl/source/sourcetreeprovider.cxx index bc7be26d7096..e212ed1b734d 100644 --- a/unoidl/source/sourcetreeprovider.cxx +++ b/unoidl/source/sourcetreeprovider.cxx @@ -25,7 +25,7 @@ #include "sourceprovider-scanner.hxx" #include "sourcetreeprovider.hxx" -#if defined MACOSX +#if defined MACOSX || defined LINUX #include #include #endif @@ -38,7 +38,7 @@ namespace { // original spelling of a file name (not even with // osl_FileStatus_Mask_Validate): OUString getFileName(OUString const & uri, osl::FileStatus const & status) { -#if defined MACOSX +#if defined MACOSX || defined LINUX sal_Int32 i = uri.lastIndexOf('/') + 1; OUString path; if (osl::FileBase::getSystemPathFromFileURL(uri.copy(0, i), path) @@ -59,7 +59,12 @@ OUString getFileName(OUString const & uri, osl::FileStatus const & status) { for (;;) { dirent ent; dirent * p; + + // readdir_r() is deprecated in current POSIX + SAL_WNODEPRECATED_DECLARATIONS_PUSH int e = readdir_r(d, &ent, &p); + SAL_WNODEPRECATED_DECLARATIONS_POP + if (e != 0) { SAL_WARN("unoidl", "cannot readdir_r"); closedir(d);