From: Mohammed Hawari Date: Fri, 10 Oct 2025 08:03:34 +0000 (+0200) Subject: selog: fix coverity warnings X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F75%2F43875%2F2;p=vpp.git selog: fix coverity warnings Change-Id: I2844a41114c122523619dfe289c14c6bebd97723 Type: fix Signed-off-by: Mohammed Hawari --- diff --git a/src/plugins/selog/api.c b/src/plugins/selog/api.c index 32c1206fa0c..2ca249c4e51 100644 --- a/src/plugins/selog/api.c +++ b/src/plugins/selog/api.c @@ -22,6 +22,10 @@ vl_api_selog_get_shm_t_handler (vl_api_selog_get_shm_t *mp) u32 file_index; reg = vl_api_client_index_to_registration (mp->client_index); + + if (!reg) + return; + if ((file_index = vl_api_registration_file_index (reg)) == VL_API_INVALID_FI) rv = VNET_API_ERROR_UNIMPLEMENTED; diff --git a/src/plugins/selog/selog_client/selog_client_example.c b/src/plugins/selog/selog_client/selog_client_example.c index 5ed8d4eaaee..bb46782ae70 100644 --- a/src/plugins/selog/selog_client/selog_client_example.c +++ b/src/plugins/selog/selog_client/selog_client_example.c @@ -14,8 +14,15 @@ */ #include #include +#include #include +volatile sig_atomic_t stop; +void +interrupt_handler (int signum) +{ + stop = 1; +} int main (int argc, char *argv[]) { @@ -30,7 +37,8 @@ main (int argc, char *argv[]) selog_client_error_strings[-rv]); return rv; } - while (1) + signal (SIGINT, interrupt_handler); + while (!stop) { selog_event_t event; int rv = selog_client_poll_event (ctx, &event, 1);