diff options
author | Pascal Quantin <pascal@wireshark.org> | 2019-07-12 14:54:40 +0200 |
---|---|---|
committer | Pascal Quantin <pascal@wireshark.org> | 2019-07-12 14:39:11 +0000 |
commit | 86cb2c78582bb78400af3651579df0b5d5bfc913 (patch) | |
tree | 1733e7f66bcf1de76ab9ce3cd63d799098e9653a /wiretap/candump.c | |
parent | 5e59d50b46a24acff4c631373d62349abd85d70b (diff) |
wiretap: do not pollute debug builds with candump debug messages
Change-Id: I2f7c4c3d23d5be27c1fac704272b9e581a4de0f7
Reviewed-on: https://code.wireshark.org/review/33912
Petri-Dish: Pascal Quantin <pascal@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal@wireshark.org>
Diffstat (limited to 'wiretap/candump.c')
-rw-r--r-- | wiretap/candump.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/wiretap/candump.c b/wiretap/candump.c index 331eaee079..0fe484d322 100644 --- a/wiretap/candump.c +++ b/wiretap/candump.c @@ -111,7 +111,9 @@ candump_dump(GSList *packets, int *err, char **err_info) static const gchar *opt_comment = "File converted to Exported PDU format during opening"; static const gchar *if_name = "Fake IF"; +#ifdef CANDUMP_DEBUG ws_debug_printf("%s: Creating a temporary file\n", G_STRFUNC); +#endif import_file_fd = create_tempfile(&filename, "Wireshark_PDU_candump_", NULL); /* Now open a file and dump to it */ @@ -169,14 +171,18 @@ candump_dump(GSList *packets, int *err, char **err_info) .idb_inf = idb_inf, }; +#ifdef CANDUMP_DEBUG ws_debug_printf("%s: Opening the temporary file for writing\n", G_STRFUNC); +#endif wdh = wtap_dump_fdopen(import_file_fd, WTAP_FILE_TYPE_SUBTYPE_PCAPNG, WTAP_UNCOMPRESSED, ¶ms, err); if (!wdh) goto error_open; +#ifdef CANDUMP_DEBUG ws_debug_printf("%s: Writing packet data into the file\n", G_STRFUNC); +#endif /* OK we've opened a new pcapng file and written the headers, time to do the packets */ for (packet = packets; packet; packet = g_slist_next(packet)) { @@ -184,7 +190,9 @@ candump_dump(GSList *packets, int *err, char **err_info) goto error_write; } +#ifdef CANDUMP_DEBUG ws_debug_printf("%s: Closing the file\n", G_STRFUNC); +#endif /* Close the written file */ if (!wtap_dump_close(wdh, err)) goto error_write; @@ -211,7 +219,9 @@ candump_parse(candump_priv_t **priv, wtap *wth, int *err, char **err_info) gchar *filename; wtap *fh; +#ifdef CANDUMP_DEBUG ws_debug_printf("%s: Trying candump file decoder\n", G_STRFUNC); +#endif packets = run_candump_parser(wth->fh, err, err_info); if (!packets) @@ -223,7 +233,9 @@ candump_parse(candump_priv_t **priv, wtap *wth, int *err, char **err_info) return WTAP_OPEN_ERROR; } +#ifdef CANDUMP_DEBUG ws_debug_printf("%s: Creating a PCAPNG file with data we've just read\n", G_STRFUNC); +#endif /* Dump packets into a temporary file */ filename = candump_dump(packets, err, err_info); g_slist_free_full(packets, g_free); @@ -231,7 +243,9 @@ candump_parse(candump_priv_t **priv, wtap *wth, int *err, char **err_info) if (!filename) return WTAP_OPEN_ERROR; +#ifdef CANDUMP_DEBUG ws_debug_printf("%s: Opening the newly created file\n", G_STRFUNC); +#endif /* Now open the file for reading */ fh = wtap_open_offline(filename, WTAP_TYPE_AUTO, err, err_info, @@ -248,7 +262,9 @@ candump_parse(candump_priv_t **priv, wtap *wth, int *err, char **err_info) (*priv)->tmp_file = fh; (*priv)->tmp_filename = filename; +#ifdef CANDUMP_DEBUG ws_debug_printf("%s: Ok\n", G_STRFUNC); +#endif return WTAP_OPEN_MINE; } |