diff options
author | Nardi Ivan <nardi.ivan@gmail.com> | 2024-01-09 10:24:36 +0100 |
---|---|---|
committer | Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> | 2024-01-18 10:21:24 +0100 |
commit | 3107a958816f3a09ce39a36b42d03a0b0046225f (patch) | |
tree | f4e0967017b591fd5d9a795cf8524f8d86bcf2c0 /example/ndpiReader.c | |
parent | d72a760ac3895dd8a0bd3e55d4b51f9e22e04e6c (diff) |
Make `ndpi_finalize_initialization()` returns an error code
We should check if the initialization was fine or not
Diffstat (limited to 'example/ndpiReader.c')
-rw-r--r-- | example/ndpiReader.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c index e597de3d4..3753bff12 100644 --- a/example/ndpiReader.c +++ b/example/ndpiReader.c @@ -2831,7 +2831,7 @@ static void on_protocol_discovered(struct ndpi_workflow * workflow, static void setupDetection(u_int16_t thread_id, pcap_t * pcap_handle) { NDPI_PROTOCOL_BITMASK enabled_bitmask; struct ndpi_workflow_prefs prefs; - int i; + int i, ret; ndpi_cfg_error rc; memset(&prefs, 0, sizeof(prefs)); @@ -2931,8 +2931,11 @@ static void setupDetection(u_int16_t thread_id, pcap_t * pcap_handle) { cfgs[i].proto, cfgs[i].param, cfgs[i].value, rc); } - - ndpi_finalize_initialization(ndpi_thread_info[thread_id].workflow->ndpi_struct); + ret = ndpi_finalize_initialization(ndpi_thread_info[thread_id].workflow->ndpi_struct); + if(ret != 0) { + fprintf(stderr, "Error ndpi_finalize_initialization: %d\n", ret); + exit(-1); + } if(enable_doh_dot_detection) ndpi_set_detection_preferences(ndpi_thread_info[thread_id].workflow->ndpi_struct, ndpi_pref_enable_tls_block_dissection, 1); |