diff options
author | Guy Harris <guy@alum.mit.edu> | 2011-04-12 01:36:12 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2011-04-12 01:36:12 +0000 |
commit | e5fe0128d75998d5bd8fc2342e3df8d03240641d (patch) | |
tree | 240aa349e54200cc953067bed6638beaa0098002 /tshark.c | |
parent | 2b8ebd389bf1d706d6922940e69b89ff038bf9df (diff) |
Allow wtap_sequential_close() and wtap_close() to return an error; this
may happen if, when reading a compressed file, we find an error in the
file's contents past the last packet (e.g., the file being cut short so
that we can't get a full buffer worth of compressed data), and that
reporting of that error is delayed (so that you can get all of the
packets that we *can* decompress). Check for those errors, at least on
the sequential read pass (the only errors we should see when closing the
random stream are errors we've already seen in the sequential stream).
svn path=/trunk/; revision=36576
Diffstat (limited to 'tshark.c')
-rw-r--r-- | tshark.c | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -2569,7 +2569,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type, gint linktype; int snapshot_length; wtap_dumper *pdh; - int err; + int err, close_err; gchar *err_info = NULL; gint64 data_offset; char *save_file_string = NULL; @@ -2665,8 +2665,12 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type, } } - /* Close the sequential I/O side, to free up memory it requires. */ - wtap_sequential_close(cf->wth); + /* Close the sequential I/O side, to free up memory it requires. + This could return an error, so if we didn't get an error while + reading, we use the status of the close. */ + close_err = wtap_sequential_close(cf->wth); + if (err == 0) + err = close_err; /* Allow the protocol dissectors to free up memory that they * don't need after the sequential run-through of the packets. */ @@ -2813,7 +2817,9 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type, } out: - wtap_close(cf->wth); + close_err = wtap_close(cf->wth); + if (err == 0) + err = close_err; cf->wth = NULL; g_free(save_file_string); |