aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToni <matzeton@googlemail.com>2021-05-11 21:38:56 +0200
committerGitHub <noreply@github.com>2021-05-11 21:38:56 +0200
commit87076dcd5bcadbe9dbd24284429db59368af04a4 (patch)
tree85e3f5d01dbc8ddf277dd48d7babc14b4f4be91d
parent5918a6542d4640e702516fe92d7d23d5a969c73c (diff)
Fixed obsolete error printing if CTRL-C is pressed. #1165 (#1184)
* This fix was proposed by @robertsong2019 Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
-rw-r--r--example/ndpiReader.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c
index 47480f111..ecedfaa1b 100644
--- a/example/ndpiReader.c
+++ b/example/ndpiReader.c
@@ -3177,7 +3177,7 @@ static pcap_t * openPcapFileOrDevice(u_int16_t thread_id, const u_char * pcap_fi
char filename[256] = { 0 };
if(strstr((char*)pcap_file, (char*)".pcap"))
- printf("ERROR: could not open pcap file %s: %s\n", pcap_file, pcap_error_buffer);
+ printf("ERROR: could not open pcap file: %s\n", pcap_error_buffer);
/* Trying to open as a playlist as last attempt */
else if((getNextPcapFileFromPlaylist(thread_id, filename, sizeof(filename)) != 0)
@@ -3359,7 +3359,8 @@ static void runPcapLoop(u_int16_t thread_id) {
printf("Unsupported datalink %d. Skip pcap\n", datalink_type);
return;
}
- if(pcap_loop(ndpi_thread_info[thread_id].workflow->pcap_handle, -1, &ndpi_process_packet, (u_char*)&thread_id) < 0)
+ int ret = pcap_loop(ndpi_thread_info[thread_id].workflow->pcap_handle, -1, &ndpi_process_packet, (u_char*)&thread_id);
+ if (ret == -1)
printf("Error while reading pcap file: '%s'\n", pcap_geterr(ndpi_thread_info[thread_id].workflow->pcap_handle));
}
}