diff options
author | Anders Broman <anders.broman@ericsson.com> | 2012-06-24 15:08:41 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2012-06-24 15:08:41 +0000 |
commit | cb801710ba3e784e5523ab8e170eb0f128905108 (patch) | |
tree | ab3ca5836759449b34ce6e9f4f99c67727bb652e /fileset.c | |
parent | ebd34c3b280a8c17948548a4e641957f79b3d34e (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.c | 44 |
1 files changed, 44 insertions, 0 deletions
@@ -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 * |