aboutsummaryrefslogtreecommitdiffstats
path: root/reordercap.c
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2013-06-19 19:31:06 +0000
committerPascal Quantin <pascal.quantin@gmail.com>2013-06-19 19:31:06 +0000
commit6bc8d874fe2216034217cc155b95aad367b7ffd0 (patch)
tree1e07f7636418f454e56289c666b4eb38b044d6d2 /reordercap.c
parent3369a97da7c3116a5fcfe9078460c1c60d857151 (diff)
Preserve summary information when reordering a file
svn path=/trunk/; revision=50054
Diffstat (limited to 'reordercap.c')
-rw-r--r--reordercap.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/reordercap.c b/reordercap.c
index 4ac1affed7..2f809e8cea 100644
--- a/reordercap.c
+++ b/reordercap.c
@@ -163,6 +163,8 @@ int main(int argc, char *argv[])
guint wrong_order_count = 0;
gboolean write_output_regardless = TRUE;
guint i;
+ wtapng_section_t *shb_hdr;
+ wtapng_iface_descriptions_t *idb_inf;
GPtrArray *frames;
FrameRecord_t *prevFrame = NULL;
@@ -203,10 +205,16 @@ int main(int argc, char *argv[])
}
DEBUG_PRINT("file_type is %u\n", wtap_file_type(wth));
+ shb_hdr = wtap_file_get_shb_info(wth);
+ idb_inf = wtap_file_get_idb_info(wth);
+
/* Open outfile (same filetype/encap as input file) */
- pdh = wtap_dump_open(outfile, wtap_file_type(wth), wtap_file_encap(wth), 65535, FALSE, &err);
+ pdh = wtap_dump_open_ng(outfile, wtap_file_type(wth), wtap_file_encap(wth),
+ 65535, FALSE, shb_hdr, idb_inf, &err);
+ g_free(idb_inf);
if (pdh == NULL) {
printf("Failed to open output file: (%s) - error %s\n", outfile, wtap_strerror(err));
+ g_free(shb_hdr);
exit(1);
}
@@ -262,8 +270,10 @@ int main(int argc, char *argv[])
/* Close outfile */
if (!wtap_dump_close(pdh, &err)) {
printf("Error closing %s: %s\n", outfile, wtap_strerror(err));
+ g_free(shb_hdr);
exit(1);
}
+ g_free(shb_hdr);
/* Finally, close infile */
wtap_fdclose(wth);