diff options
author | Guy Harris <guy@alum.mit.edu> | 2011-04-10 18:55:06 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2011-04-10 18:55:06 +0000 |
commit | 71d4caa5b92bbf9ce36583f3535a13980dcf17bc (patch) | |
tree | 842f0ca863af080e61c3435bee2a026f9f09b86f | |
parent | 332e0263edab6ec314089e9a14a25becbe78b064 (diff) |
Add ws_fstat64(), defined to be fstat on UN*X and _fstati64 on Windows.
Use it in some places where we're getting the file size.
svn path=/trunk/; revision=36544
-rw-r--r-- | fileset.c | 2 | ||||
-rw-r--r-- | wiretap/wtap.c | 2 | ||||
-rw-r--r-- | wsutil/file_util.h | 4 |
3 files changed, 5 insertions, 3 deletions
@@ -188,7 +188,7 @@ fileset_add_file(const char *dirname, const char *fname, gboolean current) if(fh != -1) { /* Get statistics */ - result = fstat( fh, &buf ); + result = ws_fstat64( fh, &buf ); /* Show statistics if they are valid */ if( result == 0 ) { diff --git a/wiretap/wtap.c b/wiretap/wtap.c index 30c71810e2..861628a60c 100644 --- a/wiretap/wtap.c +++ b/wiretap/wtap.c @@ -54,7 +54,7 @@ wtap_file_size(wtap *wth, int *err) { struct stat statb; - if (fstat(wth->fd, &statb) == -1) { + if (ws_fstat64(wth->fd, &statb) == -1) { if (err != NULL) *err = errno; return -1; diff --git a/wsutil/file_util.h b/wsutil/file_util.h index e81d8773a7..caf7a85a2e 100644 --- a/wsutil/file_util.h +++ b/wsutil/file_util.h @@ -96,6 +96,7 @@ extern FILE * ws_stdio_freopen (const gchar *filename, const gchar *mode, FILE * #define ws_write _write #define ws_close _close #define ws_dup _dup +#define ws_fstat64 _fstati64 /* use _fstati64 for 64-bit size support */ #define ws_lseek64 _lseeki64 /* use _lseeki64 for 64-bit offset support */ /* DLL loading */ @@ -134,8 +135,9 @@ extern char *getenv_utf8(const char *varname); #define ws_write write #define ws_close close #define ws_dup dup +#define ws_fstat64 fstat /* AC_SYS_LARGEFILE should make off_t 64-bit */ #define ws_lseek64 lseek /* AC_SYS_LARGEFILE should make off_t 64-bit */ -#define O_BINARY 0 /* Win32 needs the O_BINARY flag for open() */ +#define O_BINARY 0 /* Win32 needs the O_BINARY flag for open() */ #endif /* _WIN32 */ /* directory handling */ |