Add ws_fstat64(), defined to be fstat on UN*X and _fstati64 on Windows.
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 10 Apr 2011 18:55:06 +0000 (18:55 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 10 Apr 2011 18:55:06 +0000 (18:55 +0000)
Use it in some places where we're getting the file size.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@36544 f5534014-38df-0310-8fa8-9805f1628bb7

fileset.c
wiretap/wtap.c
wsutil/file_util.h

index b2db436383c562c055594b3673e7f512624251ac..63094c478d34a235947abd1041ed20d7826825ac 100644 (file)
--- a/fileset.c
+++ b/fileset.c
@@ -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 ) {
index 30c71810e21ed032ac823b5c53e35307897573f9..861628a60c3325088c8de1330d51e020f84bb670 100644 (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;
index e81d8773a7ba3f8692eb6fcb2b572c1e35c25e96..caf7a85a2e3151b182c680ee030fa75f17076d1f 100644 (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 */