diff options
-rw-r--r-- | file.c | 11 | ||||
-rw-r--r-- | wiretap/file_access.c | 8 | ||||
-rw-r--r-- | wiretap/pcapng.c | 2 | ||||
-rw-r--r-- | wiretap/wtap.h | 2 |
4 files changed, 17 insertions, 6 deletions
@@ -4284,11 +4284,12 @@ cf_save_records(capture_file *cf, const char *fname, guint save_format, if (save_format == cf->cd_t && compressed == cf->iscompressed && !discard_comments && !cf->unsaved_changes - && !(addr_lists && wtap_dump_has_name_resolution(save_format))) { - /* We're saving in the format it's already in, and we're - not discarding comments, and there are no changes we have - in memory that aren't saved to the file, and we have no name - resolution blocks to write, so we can just move or copy the raw data. */ + && (wtap_addrinfo_list_empty(addr_lists) || !wtap_dump_has_name_resolution(save_format))) { + /* We're saving in the format it's already in, and we're not discarding + comments, and there are no changes we have in memory that aren't saved + to the file, and we have no name resolution information to write or + the file format we're saving in doesn't support writing name + resolution information, so we can just move or copy the raw data. */ if (cf->is_tempfile) { /* The file being saved is a temporary file from a live diff --git a/wiretap/file_access.c b/wiretap/file_access.c index 8740756df2..307fa17e55 100644 --- a/wiretap/file_access.c +++ b/wiretap/file_access.c @@ -2608,6 +2608,14 @@ wtap_set_bytes_dumped(wtap_dumper *wdh, gint64 bytes_dumped) } gboolean +wtap_addrinfo_list_empty(addrinfo_lists_t *addrinfo_lists) +{ + return (addrinfo_lists == NULL) || + ((addrinfo_lists->ipv4_addr_list == NULL) && + (addrinfo_lists->ipv6_addr_list == NULL)); +} + +gboolean wtap_dump_set_addrinfo_list(wtap_dumper *wdh, addrinfo_lists_t *addrinfo_lists) { if (!wdh || wdh->file_type_subtype < 0 || wdh->file_type_subtype >= wtap_num_file_types_subtypes diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c index 9217781341..6d82f42a7d 100644 --- a/wiretap/pcapng.c +++ b/wiretap/pcapng.c @@ -3376,7 +3376,7 @@ pcapng_write_name_resolution_block(wtap_dumper *wdh, int *err) hashipv6_t *ipv6_hash_list_entry; int i; - if ((!wdh->addrinfo_lists) || ((!wdh->addrinfo_lists->ipv4_addr_list)&&(!wdh->addrinfo_lists->ipv6_addr_list))) { + if (wtap_addrinfo_list_empty(wdh->addrinfo_lists)) { /* * No name/address pairs to write. * XXX - what if we have options? diff --git a/wiretap/wtap.h b/wiretap/wtap.h index 5c3fece007..dbbaf83667 100644 --- a/wiretap/wtap.h +++ b/wiretap/wtap.h @@ -1932,6 +1932,8 @@ WS_DLL_PUBLIC void wtap_set_bytes_dumped(wtap_dumper *wdh, gint64 bytes_dumped); struct addrinfo; WS_DLL_PUBLIC +gboolean wtap_addrinfo_list_empty(addrinfo_lists_t *addrinfo_lists); +WS_DLL_PUBLIC gboolean wtap_dump_set_addrinfo_list(wtap_dumper *wdh, addrinfo_lists_t *addrinfo_lists); WS_DLL_PUBLIC gboolean wtap_dump_get_needs_reload(wtap_dumper *wdh); |