summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--file.c19
-rw-r--r--tshark.c14
-rw-r--r--wiretap/wtap.c35
-rw-r--r--wiretap/wtap.h4
4 files changed, 16 insertions, 56 deletions
diff --git a/file.c b/file.c
index 5d1369222d..075d688f04 100644
--- a/file.c
+++ b/file.c
@@ -511,7 +511,7 @@ calc_progbar_val(capture_file *cf, gint64 size, gint64 file_pos, gchar *status_s
cf_read_status_t
cf_read(capture_file *cf, gboolean from_save)
{
- int err, close_err;
+ int err;
gchar *err_info;
const gchar *name_ptr;
const char *errmsg;
@@ -667,12 +667,8 @@ cf_read(capture_file *cf, gboolean from_save)
/* We're done reading sequentially through the file. */
cf->state = FILE_READ_DONE;
- /* 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;
+ /* Close the sequential I/O side, to free up memory it requires. */
+ wtap_sequential_close(cf->wth);
/* Allow the protocol dissectors to free up memory that they
* don't need after the sequential run-through of the packets. */
@@ -894,7 +890,6 @@ cf_fake_continue_tail(capture_file *cf) {
cf_read_status_t
cf_finish_tail(capture_file *cf, int *err)
{
- int close_err;
gchar *err_info;
gint64 data_offset;
dfilter_t *dfcode;
@@ -959,12 +954,8 @@ cf_finish_tail(capture_file *cf, int *err)
cf->state = FILE_READ_DONE;
/* We're done reading sequentially through the file; 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;
+ sequential I/O side, to free up memory it requires. */
+ wtap_sequential_close(cf->wth);
/* Allow the protocol dissectors to free up memory that they
* don't need after the sequential run-through of the packets. */
diff --git a/tshark.c b/tshark.c
index d15e53432c..37a963ff12 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, close_err;
+ int err;
gchar *err_info = NULL;
gint64 data_offset;
char *save_file_string = NULL;
@@ -2665,12 +2665,8 @@ 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.
- 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;
+ /* Close the sequential I/O side, to free up memory it requires. */
+ wtap_sequential_close(cf->wth);
/* Allow the protocol dissectors to free up memory that they
* don't need after the sequential run-through of the packets. */
@@ -2817,9 +2813,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
}
out:
- close_err = wtap_close(cf->wth);
- if (err == 0)
- err = close_err;
+ wtap_close(cf->wth);
cf->wth = NULL;
g_free(save_file_string);
diff --git a/wiretap/wtap.c b/wiretap/wtap.c
index a4b258f44b..7dcced68fe 100644
--- a/wiretap/wtap.c
+++ b/wiretap/wtap.c
@@ -623,25 +623,14 @@ const char
needed by the random-access side.
Instead, if the subtype has a "sequential close" function, we call it,
- to free up stuff used only by the sequential side.
-
- If there are any errors detected as part of the process of closing,
- return an error indication; regardless of whether there were or
- weren't, the close is done. */
-int
+ to free up stuff used only by the sequential side. */
+void
wtap_sequential_close(wtap *wth)
{
- int ret = 0;
-
if (wth->subtype_sequential_close != NULL)
(*wth->subtype_sequential_close)(wth);
if (wth->fh != NULL) {
- /*
- * Get any delayed errors before we close the
- * handle.
- */
- ret = file_error(wth->fh);
file_close(wth->fh);
wth->fh = NULL;
}
@@ -651,8 +640,6 @@ wtap_sequential_close(wtap *wth)
g_free(wth->frame_buffer);
wth->frame_buffer = NULL;
}
-
- return ret;
}
static void
@@ -661,26 +648,16 @@ g_fast_seek_item_free(gpointer data, gpointer user_data _U_)
g_free(data);
}
-int
+void
wtap_close(wtap *wth)
{
- int ret;
-
- ret = wtap_sequential_close(wth);
+ wtap_sequential_close(wth);
if (wth->subtype_close != NULL)
(*wth->subtype_close)(wth);
- if (wth->random_fh != NULL) {
- /*
- * If we didn't get any delayed error from the
- * sequential handle, see if there's one for
- * the random handle before we close it.
- */
- if (ret == 0)
- ret = file_error(wth->random_fh);
+ if (wth->random_fh != NULL)
file_close(wth->random_fh);
- }
if (wth->priv != NULL)
g_free(wth->priv);
@@ -690,8 +667,6 @@ wtap_close(wtap *wth)
g_ptr_array_free(wth->fast_seek, TRUE);
}
g_free(wth);
-
- return ret;
}
void
diff --git a/wiretap/wtap.h b/wiretap/wtap.h
index 76e1f0a2e0..858dcf0520 100644
--- a/wiretap/wtap.h
+++ b/wiretap/wtap.h
@@ -917,8 +917,8 @@ int wtap_file_encap(wtap *wth);
int wtap_file_tsprecision(wtap *wth);
/*** close the current file ***/
-int wtap_sequential_close(wtap *wth);
-int wtap_close(wtap *wth);
+void wtap_sequential_close(wtap *wth);
+void wtap_close(wtap *wth);
/*** dump packets into a capture file ***/
gboolean wtap_dump_can_open(int filetype);