From 910df4e79f5614397c7556c6c1a8037aee8b92be Mon Sep 17 00:00:00 2001 From: Jason Dellaluce Date: Fri, 3 May 2024 14:26:17 +0000 Subject: [PATCH] fix(userspace/libsinsp): remove bad ASSERTs Signed-off-by: Jason Dellaluce --- userspace/libsinsp/event.cpp | 1 - userspace/libsinsp/fdinfo.cpp | 1 - userspace/libsinsp/logger.cpp | 2 +- userspace/libsinsp/sinsp_filtercheck.cpp | 1 - 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/userspace/libsinsp/event.cpp b/userspace/libsinsp/event.cpp index af1ec7c714..d36ffb3ed7 100644 --- a/userspace/libsinsp/event.cpp +++ b/userspace/libsinsp/event.cpp @@ -802,7 +802,6 @@ std::string sinsp_evt::get_base_dir(uint32_t id, sinsp_threadinfo *tinfo) // Ensure the index points to an actual FD if (dir_param_info->type != PT_FD) { - ASSERT(dir_param_info->type == PT_FD); return cwd; } diff --git a/userspace/libsinsp/fdinfo.cpp b/userspace/libsinsp/fdinfo.cpp index 724cc9531b..b011169d90 100644 --- a/userspace/libsinsp/fdinfo.cpp +++ b/userspace/libsinsp/fdinfo.cpp @@ -374,7 +374,6 @@ bool sinsp_fdtable::erase(int64_t fd) // call that created this fd. The assertion will detect it, while in release mode we just // keep going. // - ASSERT(false); if (m_inspector != nullptr && m_inspector->get_sinsp_stats_v2()) { m_inspector->get_sinsp_stats_v2()->m_n_failed_fd_lookups++; diff --git a/userspace/libsinsp/logger.cpp b/userspace/libsinsp/logger.cpp index eb4cf1624a..4d4066d555 100644 --- a/userspace/libsinsp/logger.cpp +++ b/userspace/libsinsp/logger.cpp @@ -310,7 +310,6 @@ size_t sinsp_logger::decode_severity(const std::string &str, severity& sev) void sinsp_logger::reset() { m_callback = nullptr; - m_flags = OT_NONE; m_sev = SEV_INFO; if(m_file) { @@ -318,6 +317,7 @@ void sinsp_logger::reset() fclose(m_file); m_file = nullptr; } + m_flags = OT_NONE; } sinsp_logger* libsinsp_logger() diff --git a/userspace/libsinsp/sinsp_filtercheck.cpp b/userspace/libsinsp/sinsp_filtercheck.cpp index 955d5cad78..d6ab424889 100644 --- a/userspace/libsinsp/sinsp_filtercheck.cpp +++ b/userspace/libsinsp/sinsp_filtercheck.cpp @@ -1520,7 +1520,6 @@ bool sinsp_filter_check::compare_rhs(cmpop op, ppm_param_type type, std::vector< } return false; default: - ASSERT(false); throw sinsp_exception("list filter '" + std::string(m_info.m_fields[m_field_id].m_name) + "' only supports operators 'exists', 'in' and 'intersects'");