summaryrefslogtreecommitdiff
path: root/editcap.c
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2012-06-15 12:27:21 +0000
committerAnders Broman <anders.broman@ericsson.com>2012-06-15 12:27:21 +0000
commit665b95d15468761a577420593c017824d57f16c1 (patch)
tree47ac32c67af7a8912e4c08d227f0619970a50044 /editcap.c
parentcf28e12ed78d25d4b03c13c165f3a5935566c4f9 (diff)
downloadwireshark-665b95d15468761a577420593c017824d57f16c1.tar.gz
Try to fix pcap-ng - most files created by editcap -c have no IDB
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7350 By using wtap_dump_open_ng() in all places. svn path=/trunk/; revision=43271
Diffstat (limited to 'editcap.c')
-rw-r--r--editcap.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/editcap.c b/editcap.c
index 1837a0e736..6919eb9920 100644
--- a/editcap.c
+++ b/editcap.c
@@ -1161,9 +1161,6 @@ main(int argc, char *argv[])
wtap_strerror(err));
exit(2);
}
-
- g_free(idb_inf);
- idb_inf = NULL;
}
g_assert(filename);
@@ -1187,9 +1184,9 @@ main(int argc, char *argv[])
fprintf(stderr, "Continuing writing in file %s\n", filename);
}
- pdh = wtap_dump_open(filename, out_file_type, out_frame_type,
+ pdh = wtap_dump_open_ng(filename, out_file_type, out_frame_type,
snaplen ? MIN(snaplen, wtap_snapshot_length(wth)) : wtap_snapshot_length(wth),
- FALSE /* compressed */, &err);
+ FALSE /* compressed */, shb_hdr, idb_inf, &err);
if (pdh == NULL) {
fprintf(stderr, "editcap: Can't open or create %s: %s\n", filename,
@@ -1218,9 +1215,9 @@ main(int argc, char *argv[])
fprintf(stderr, "Continuing writing in file %s\n", filename);
}
- pdh = wtap_dump_open(filename, out_file_type, out_frame_type,
+ pdh = wtap_dump_open_ng(filename, out_file_type, out_frame_type,
snaplen ? MIN(snaplen, wtap_snapshot_length(wth)) : wtap_snapshot_length(wth),
- FALSE /* compressed */, &err);
+ FALSE /* compressed */, shb_hdr, idb_inf, &err);
if (pdh == NULL) {
fprintf(stderr, "editcap: Can't open or create %s: %s\n", filename,
wtap_strerror(err));
@@ -1485,6 +1482,7 @@ main(int argc, char *argv[])
count++;
}
+
g_free(fprefix);
g_free(fsuffix);
@@ -1509,9 +1507,9 @@ main(int argc, char *argv[])
g_free (filename);
filename = g_strdup(argv[optind+1]);
- pdh = wtap_dump_open(filename, out_file_type, out_frame_type,
+ pdh = wtap_dump_open_ng(filename, out_file_type, out_frame_type,
snaplen ? MIN(snaplen, wtap_snapshot_length(wth)): wtap_snapshot_length(wth),
- FALSE /* compressed */, &err);
+ FALSE /* compressed */, shb_hdr, idb_inf, &err);
if (pdh == NULL) {
fprintf(stderr, "editcap: Can't open or create %s: %s\n", filename,
wtap_strerror(err));
@@ -1519,6 +1517,9 @@ main(int argc, char *argv[])
}
}
+ g_free(idb_inf);
+ idb_inf = NULL;
+
if (!wtap_dump_close(pdh, &err)) {
fprintf(stderr, "editcap: Error writing to %s: %s\n", filename,