From f766edc81ea8deed90b7ddc0a6312844dff78f15 Mon Sep 17 00:00:00 2001 From: Petr Sumbera Date: Tue, 25 Nov 2025 08:41:08 +0000 Subject: [PATCH] Allow build on Solaris 11.4 --- CMakeLists.txt | 2 +- CMakeModules/FindPCRE2.cmake | 1 + src/tree_schema.c | 8 ++++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7fa2204c2..3126e7fe7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,7 +76,7 @@ if(WIN32) set(CMAKE_C_FLAGS "/Zc:preprocessor /W3 /wd4711 /w14013 /utf-8 ${CMAKE_C_FLAGS}") else() # global C flags - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wpedantic -std=c11") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wpedantic") endif() include_directories(${PROJECT_BINARY_DIR}/libyang ${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/src/plugins_exts) diff --git a/CMakeModules/FindPCRE2.cmake b/CMakeModules/FindPCRE2.cmake index a05d998c4..da362133f 100644 --- a/CMakeModules/FindPCRE2.cmake +++ b/CMakeModules/FindPCRE2.cmake @@ -15,6 +15,7 @@ else() pcre2.h PATHS /usr/include + /usr/include/pcre /usr/local/include /opt/local/include /sw/include diff --git a/src/tree_schema.c b/src/tree_schema.c index 916a834e4..7d9a26615 100644 --- a/src/tree_schema.c +++ b/src/tree_schema.c @@ -2370,7 +2370,11 @@ lys_search_localfile_file_type(const struct dirent *file, const char *wd, struct *skip = 0; +#ifdef __sun__ + if (1) { +#else if ((file->d_type == DT_UNKNOWN) || (file->d_type == DT_LNK)) { +#endif /* FS does not support this field or its a symbolic link, need to call stat */ if (asprintf(&str, "%s/%s", wd, file->d_name) == -1) { LOGMEM(NULL); @@ -2387,6 +2391,9 @@ lys_search_localfile_file_type(const struct dirent *file, const char *wd, struct /* stat - file */ is_reg = 1; } +#ifdef __sun__ + } +#else } else if (file->d_type == DT_DIR) { /* dirent - dir */ is_dir = 1; @@ -2394,6 +2401,7 @@ lys_search_localfile_file_type(const struct dirent *file, const char *wd, struct /* dirent - file */ is_reg = 1; } +#endif if (is_dir && (dirs->count || !implicit_cwd)) { /* we have another subdirectory in searchpath to explore,