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
This commit is contained in:
Guy Harris 2011-04-10 18:55:06 +00:00
parent 332e0263ed
commit 71d4caa5b9
3 changed files with 5 additions and 3 deletions

View File

@ -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 ) {

View File

@ -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;

View File

@ -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 */