diff options
author | Guy Harris <guy@alum.mit.edu> | 2011-05-09 08:12:26 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2011-05-09 08:12:26 +0000 |
commit | 3de2b1be7405adac31bd796f3380b9d8edbe0f99 (patch) | |
tree | b444b752e4435e0b436bbf8eef5c96af9f35a2de /wiretap/wtap.c | |
parent | 88a1ed85e3156e80c3fed4848d651aae433dc8d8 (diff) | |
download | wireshark-3de2b1be7405adac31bd796f3380b9d8edbe0f99.tar.gz |
Get rid of the fd member of a wth structure; the FILE_T's in that
structure include a file descriptor. Add a wtap_fstat() for the file
readers that use file times to generate time stamps (we really need a
way to say "this file has no time stamps" or "this file has only
relative time stamps).
svn path=/trunk/; revision=37026
Diffstat (limited to 'wiretap/wtap.c')
-rw-r--r-- | wiretap/wtap.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/wiretap/wtap.c b/wiretap/wtap.c index 145567a975..e494a9e757 100644 --- a/wiretap/wtap.c +++ b/wiretap/wtap.c @@ -54,14 +54,24 @@ wtap_file_size(wtap *wth, int *err) { ws_statb64 statb; - if (ws_fstat64(wth->fd, &statb) == -1) { - if (err != NULL) - *err = errno; + if (file_fstat((wth->fh == NULL) ? wth->random_fh : wth->fh, + &statb, err) == -1) return -1; - } return statb.st_size; } +/* + * Do an fstat on the file. + */ +int +wtap_fstat(wtap *wth, ws_statb64 *statb, int *err) +{ + if (file_fstat((wth->fh == NULL) ? wth->random_fh : wth->fh, + statb, err) == -1) + return -1; + return 0; +} + int wtap_file_type(wtap *wth) { |