summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--file.c4
-rw-r--r--fileset.c44
-rw-r--r--fileset.h2
3 files changed, 50 insertions, 0 deletions
diff --git a/file.c b/file.c
index 7fdbf1747a..e5c75f556e 100644
--- a/file.c
+++ b/file.c
@@ -953,6 +953,10 @@ cf_finish_tail(capture_file *cf, int *err)
packets we've read. */
cf->lnk_t = wtap_file_encap(cf->wth);
+ /* Update the details in the file-set dialog, as the capture file
+ * has likely grown since we first stat-ed it */
+ fileset_update_file(cf->filename);
+
if (*err != 0) {
/* We got an error reading the capture file.
XXX - pop up a dialog box? */
diff --git a/fileset.c b/fileset.c
index 43243a97c7..f4c485b2b0 100644
--- a/fileset.c
+++ b/fileset.c
@@ -171,6 +171,50 @@ fileset_is_file_in_set(const char *fname1, const char *fname2)
return TRUE;
}
+/* GCompareFunc helper for g_list_find_custom() */
+static gint
+fileset_find_by_path(gconstpointer a, gconstpointer b)
+{
+ const fileset_entry *entry;
+ const char *path;
+
+ entry = (const fileset_entry *) a;
+ path = (const char *) b;
+
+ return g_strcmp0(entry->fullname, path);
+}
+
+/* update the time and size of this file in the list */
+void
+fileset_update_file(const char *path)
+{
+ int fh, result;
+ ws_statb64 buf;
+ fileset_entry *entry = NULL;
+ GList *entry_list;
+
+ fh = ws_open( path, O_RDONLY, 0000 /* no creation so don't matter */);
+ if(fh != -1) {
+
+ /* Get statistics */
+ result = ws_fstat64( fh, &buf );
+
+ /* Show statistics if they are valid */
+ if( result == 0 ) {
+ entry_list = g_list_find_custom(set.entries, path,
+ fileset_find_by_path);
+
+ if (entry_list) {
+ entry = (fileset_entry *) entry_list->data;
+ entry->ctime = buf.st_ctime;
+ entry->mtime = buf.st_mtime;
+ entry->size = buf.st_size;
+ }
+ }
+
+ ws_close(fh);
+ }
+}
/* we know this file is part of the set, so add it */
static fileset_entry *
diff --git a/fileset.h b/fileset.h
index c6d0dd9294..95d3174e71 100644
--- a/fileset.h
+++ b/fileset.h
@@ -67,6 +67,8 @@ extern void fileset_file_closed(void);
extern void fileset_update_dlg(void);
+extern void fileset_update_file(const char *path);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */