aboutsummaryrefslogtreecommitdiffstats
path: root/fileset.c
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2012-06-24 15:08:41 +0000
committerAnders Broman <anders.broman@ericsson.com>2012-06-24 15:08:41 +0000
commitcb801710ba3e784e5523ab8e170eb0f128905108 (patch)
treeab3ca5836759449b34ce6e9f4f99c67727bb652e /fileset.c
parentebd34c3b280a8c17948548a4e641957f79b3d34e (diff)
From Evan Huus:
Size wrong in "File Set List" for just-finished captures. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7370 svn path=/trunk/; revision=43455
Diffstat (limited to 'fileset.c')
-rw-r--r--fileset.c44
1 files changed, 44 insertions, 0 deletions
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 *