diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-11-10 03:28:18 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-11-10 11:29:05 +0000 |
commit | 6ae50ebf28cd40d5c7e1ef5493c22e896564c4f2 (patch) | |
tree | d6c8892dc9725a0b2171beb99c538af5e24a7e79 /wiretap/file_access.c | |
parent | b3fa7e5d3d70fdb2425f522b07786adbfd24bfb1 (diff) |
Call wtap_dump_open_check() in wtap_dump_init_dumper().
The callers of wtap_dump_init_dumper() always call
wtap_dump_open_check() first, with the same arguments in all cases; pull
the latter call into wtap_dump_init_dumper() itself.
Change-Id: I2b44dc3a018745e175b5c74ff1a346749fec2b71
Reviewed-on: https://code.wireshark.org/review/11681
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/file_access.c')
-rw-r--r-- | wiretap/file_access.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/wiretap/file_access.c b/wiretap/file_access.c index 8a965f100d..53f66411e6 100644 --- a/wiretap/file_access.c +++ b/wiretap/file_access.c @@ -2148,6 +2148,11 @@ wtap_dump_init_dumper(int file_type_subtype, int encap, int snaplen, gboolean co wtap_dumper *wdh; wtapng_if_descr_t descr, *file_int_data; + /* Check whether we can open a capture file with that file type + and that encapsulation. */ + if (!wtap_dump_open_check(file_type_subtype, encap, compressed, err)) + return NULL; + /* Allocate a data structure for the output stream. */ wdh = wtap_dump_alloc_wdh(file_type_subtype, encap, snaplen, compressed, err); if (wdh == NULL) @@ -2206,11 +2211,6 @@ wtap_dump_open_ng(const char *filename, int file_type_subtype, int encap, wtap_dumper *wdh; WFILE_T fh; - /* Check whether we can open a capture file with that file type - and that encapsulation. */ - if (!wtap_dump_open_check(file_type_subtype, encap, compressed, err)) - return NULL; - /* Allocate and initialize a data structure for the output stream. */ wdh = wtap_dump_init_dumper(file_type_subtype, encap, snaplen, compressed, shb_hdr, idb_inf, nrb_hdr, err); @@ -2254,11 +2254,6 @@ wtap_dump_fdopen_ng(int fd, int file_type_subtype, int encap, int snaplen, wtap_dumper *wdh; WFILE_T fh; - /* Check whether we can open a capture file with that file type - and that encapsulation. */ - if (!wtap_dump_open_check(file_type_subtype, encap, compressed, err)) - return NULL; - /* Allocate and initialize a data structure for the output stream. */ wdh = wtap_dump_init_dumper(file_type_subtype, encap, snaplen, compressed, shb_hdr, idb_inf, nrb_hdr, err); @@ -2300,11 +2295,6 @@ wtap_dump_open_stdout_ng(int file_type_subtype, int encap, int snaplen, wtap_dumper *wdh; WFILE_T fh; - /* Check whether we can open a capture file with that file type - and that encapsulation. */ - if (!wtap_dump_open_check(file_type_subtype, encap, compressed, err)) - return NULL; - /* Allocate and initialize a data structure for the output stream. */ wdh = wtap_dump_init_dumper(file_type_subtype, encap, snaplen, compressed, shb_hdr, idb_inf, nrb_hdr, err); |