aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/file_access.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2011-05-09 08:12:26 +0000
committerGuy Harris <guy@alum.mit.edu>2011-05-09 08:12:26 +0000
commit3de2b1be7405adac31bd796f3380b9d8edbe0f99 (patch)
treeb444b752e4435e0b436bbf8eef5c96af9f35a2de /wiretap/file_access.c
parent88a1ed85e3156e80c3fed4848d651aae433dc8d8 (diff)
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/file_access.c')
-rw-r--r--wiretap/file_access.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/wiretap/file_access.c b/wiretap/file_access.c
index ed213e6df8..c66a149ad2 100644
--- a/wiretap/file_access.c
+++ b/wiretap/file_access.c
@@ -222,6 +222,7 @@ void wtap_register_open_routine(wtap_open_routine_t open_routine, gboolean has_m
wtap* wtap_open_offline(const char *filename, int *err, char **err_info,
gboolean do_random)
{
+ int fd;
ws_statb64 statb;
wtap *wth;
unsigned int i;
@@ -296,23 +297,23 @@ wtap* wtap_open_offline(const char *filename, int *err, char **err_info,
* a file_close of wth->fh closing the standard
* input of the process.
*/
- wth->fd = ws_dup(0);
- if (wth->fd < 0) {
+ fd = ws_dup(0);
+ if (fd < 0) {
*err = errno;
g_free(wth);
return NULL;
}
#ifdef _WIN32
- if (_setmode(wth->fd, O_BINARY) == -1) {
+ if (_setmode(fd, O_BINARY) == -1) {
/* "Shouldn't happen" */
*err = errno;
g_free(wth);
return NULL;
}
#endif
- if (!(wth->fh = filed_open(wth->fd))) {
+ if (!(wth->fh = filed_open(fd))) {
*err = errno;
- ws_close(wth->fd);
+ ws_close(fd);
g_free(wth);
return NULL;
}