aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-07-25 13:50:00 +0200
committerGuy Harris <guy@alum.mit.edu>2014-07-25 21:26:01 +0000
commit0492921adc1d6e3978b93bcac35140510228a62a (patch)
treeb1a2314608c978c1788bdedfa329e4bea9fac6c1 /wiretap
parentc3e42cc6b4e21b0278e8bae5064ac1b99031f045 (diff)
Replace lseek/fstat by ws_lseek64/ws_fstat64
lseek returns an off_t type which is system-dependent. Use ws_lseek64 in favor of lseek as that supports 64-bit quanities. Use ws_fstat64 instead of stat to support 64-bit file sizes on Windows. For the majority of the changes, this makes no difference as they do not apply to Windows ("ifndef _WIN32"; availability of st_blksize). There are no other users of "struct stat" besides the portability code in wsutil. Forbid the use of fstat and lseek in checkAPIs. Change-Id: I17b930ab9543f21a9d3100f3795d250c9b9ae459 Reviewed-on: https://code.wireshark.org/review/3198 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/file_access.c4
-rw-r--r--wiretap/file_wrappers.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/wiretap/file_access.c b/wiretap/file_access.c
index f320ffa236..3d21356361 100644
--- a/wiretap/file_access.c
+++ b/wiretap/file_access.c
@@ -2191,11 +2191,11 @@ static gboolean wtap_dump_open_finish(wtap_dumper *wdh, int file_type_subtype, g
cant_seek = TRUE;
} else {
fd = fileno((FILE *)wdh->fh);
- if (lseek(fd, 1, SEEK_CUR) == -1)
+ if (ws_lseek64(fd, 1, SEEK_CUR) == (off_t) -1)
cant_seek = TRUE;
else {
/* Undo the seek. */
- lseek(fd, 0, SEEK_SET);
+ ws_lseek64(fd, 0, SEEK_SET);
cant_seek = FALSE;
}
}
diff --git a/wiretap/file_wrappers.c b/wiretap/file_wrappers.c
index 0f30493ee6..a067193b13 100644
--- a/wiretap/file_wrappers.c
+++ b/wiretap/file_wrappers.c
@@ -781,7 +781,7 @@ FILE_T
file_fdopen(int fd)
{
#ifdef _STATBUF_ST_BLKSIZE /* XXX, _STATBUF_ST_BLKSIZE portable? */
- struct stat st;
+ ws_statb64 st;
#endif
int want = GZBUFSIZE;
FILE_T state;
@@ -812,7 +812,7 @@ file_fdopen(int fd)
gz_reset(state);
#ifdef _STATBUF_ST_BLKSIZE
- if (fstat(fd, &st) >= 0) {
+ if (ws_fstat64(fd, &st) >= 0) {
/*
* Yes, st_blksize can be bigger than an int; apparently,
* it's a long on LP64 Linux, for example.