aboutsummaryrefslogtreecommitdiffstats
path: root/tshark.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2011-04-12 01:36:12 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2011-04-12 01:36:12 +0000
commitdc354827a73162aebfef9bfd49111e5964a11285 (patch)
tree240aa349e54200cc953067bed6638beaa0098002 /tshark.c
parenta4f1aa318b959e195cafd9f488f022fcaa77ab1c (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). git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@36576 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'tshark.c')
-rw-r--r--tshark.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/tshark.c b/tshark.c
index 37a963ff12..d15e53432c 100644
--- a/tshark.c
+++ b/tshark.c
@@ -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);