diff --git a/userspace/libsinsp/CMakeLists.txt b/userspace/libsinsp/CMakeLists.txt index e2f7dae723..19920660e0 100644 --- a/userspace/libsinsp/CMakeLists.txt +++ b/userspace/libsinsp/CMakeLists.txt @@ -29,6 +29,9 @@ if(NOT MSVC) endif() add_definitions(-DHAVE_PWD_H) add_definitions(-DHAVE_GRP_H) + if(MUSL_OPTIMIZED_BUILD) + add_definitions(-DMUSL_OPTIMIZED) + endif() endif() if(NOT DEFINED CHISEL_TOOL_LIBRARY_NAME) diff --git a/userspace/libsinsp/test/user.ut.cpp b/userspace/libsinsp/test/user.ut.cpp index 07dd039855..1a14e7b726 100644 --- a/userspace/libsinsp/test/user.ut.cpp +++ b/userspace/libsinsp/test/user.ut.cpp @@ -169,12 +169,12 @@ class usergroup_manager_host_root_test : public sinsp_with_test_input { std::ofstream ofs(etc + "/passwd"); - ofs << "toor:x:0:0:toor:/toor:/bin/ash"; + ofs << "toor:x:0:0:toor:/toor:/bin/ash" << std::endl; ofs.close(); } { std::ofstream ofs(etc + "/group"); - ofs << "toor:x:0:toor"; + ofs << "toor:x:0:toor" << std::endl; ofs.close(); } } diff --git a/userspace/libsinsp/user.cpp b/userspace/libsinsp/user.cpp index e109fe9601..acdf3fd427 100644 --- a/userspace/libsinsp/user.cpp +++ b/userspace/libsinsp/user.cpp @@ -38,7 +38,7 @@ limitations under the License. // See fgetpwent() / fgetgrent() feature test macros: // https://man7.org/linux/man-pages/man3/fgetpwent.3.html // https://man7.org/linux/man-pages/man3/fgetgrent.3.html -#if defined _DEFAULT_SOURCE || defined _SVID_SOURCE +#if defined(MUSL_OPTIMIZED) || defined(_DEFAULT_SOURCE) || defined(_SVID_SOURCE) #define HAVE_FGET__ENT #endif