diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-12-17 16:02:50 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-12-18 00:03:26 +0000 |
commit | 51522b33723dec4dd0481dcabc261010be39937c (patch) | |
tree | 4c772ba5dd3a61a470784464e39573ca27c5028c /randpkt.c | |
parent | 8ce0f122011f26ab4e81172e9899ed27a5508abd (diff) | |
download | wireshark-51522b33723dec4dd0481dcabc261010be39937c.tar.gz wireshark-51522b33723dec4dd0481dcabc261010be39937c.tar.bz2 wireshark-51522b33723dec4dd0481dcabc261010be39937c.zip |
Handle "I can't map this for that file format" better.
For cases where record (meta)data is something that can't be written out
in a particular file format, return WTAP_ERR_UNWRITABLE_REC_DATA along
with an err_info string.
Report (and free) that err_info string in cases where
WTAP_ERR_UNWRITABLE_REC_DATA is returned.
Clean up some other error reporting cases, and flag with an XXX some
cases where we aren't reporting errors at all, while we're at it.
Change-Id: I91d02093af0d42c24ec4634c2c773b30f3d39ab3
Reviewed-on: https://code.wireshark.org/review/5823
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'randpkt.c')
-rw-r--r-- | randpkt.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -498,6 +498,7 @@ main(int argc, char **argv) struct wtap_pkthdr pkthdr; union wtap_pseudo_header *ps_header = &pkthdr.pseudo_header; int i, j, len_this_pkt, len_random, err; + gchar *err_info; guint8 buffer[65536]; int opt; @@ -619,7 +620,18 @@ main(int argc, char **argv) } } - wtap_dump(dump, &pkthdr, &buffer[0], &err); + /* XXX - report errors! */ + if (!wtap_dump(dump, &pkthdr, &buffer[0], &err, &err_info)) { + switch (err) { + + case WTAP_ERR_UNWRITABLE_REC_DATA: + g_free(err_info); + break; + + default: + break; + } + } } wtap_dump_close(dump, &err); |