aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/lanalyzer.c
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2013-03-17 09:20:13 +0000
committerAnders Broman <anders.broman@ericsson.com>2013-03-17 09:20:13 +0000
commit05a8c94ddf4bc48888d3dfbdcfff3eddc0f15093 (patch)
tree97ab76474fb96e5d33e9769d8a50ed6f584bbe9f /wiretap/lanalyzer.c
parent2e52e2ac997ca58caabee3270b5a6c3f96159ff0 (diff)
From beroset:
implemented wtap_dump_file_seek() and _tell() implemented the previously declared but unimplemented wtap_dump_file_seek() and wtap_dump_file_tell() functions and used them in the seven files that had previously used a plain ftell or fseek and added error checking as appropriate. I also added a new error WTAP_ERR_CANT_SEEK_COMPRESSED and put it next to WTAP_ERR_CANT_SEEK causing renumbering of two of the existing error codes. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 svn path=/trunk/; revision=48348
Diffstat (limited to 'wiretap/lanalyzer.c')
-rw-r--r--wiretap/lanalyzer.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/wiretap/lanalyzer.c b/wiretap/lanalyzer.c
index f4c474ab17..c3ed8f2efa 100644
--- a/wiretap/lanalyzer.c
+++ b/wiretap/lanalyzer.c
@@ -261,6 +261,13 @@ static const guint8 LA_CyclicInformationFake[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
+static const guint8 z64[64] = {
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
+ };
+
typedef struct {
time_t start;
} lanalyzer_t;
@@ -617,7 +624,6 @@ static gboolean lanalyzer_seek_read(wtap *wth, gint64 seek_off,
*---------------------------------------------------*/
static gboolean s0write(wtap_dumper *wdh, size_t cnt, int *err)
{
- static const guint8 z64[64];
size_t snack;
while (cnt) {
@@ -808,10 +814,9 @@ gboolean lanalyzer_dump_open(wtap_dumper *wdh, int *err)
+ sizeof (LA_CyclicInformationFake)
+ LA_IndexRecordSize;
- if (fseek(wdh->fh, jump, SEEK_SET) == -1) {
- *err = errno;
+ if (wtap_dump_file_seek(wdh, jump, SEEK_SET, err) == -1)
return FALSE;
- }
+
wdh->bytes_dumped = jump;
return TRUE;
}
@@ -839,7 +844,8 @@ static gboolean lanalyzer_dump_header(wtap_dumper *wdh, int *err)
if (fT == NULL)
return FALSE;
- fseek(wdh->fh, 0, SEEK_SET);
+ if (wtap_dump_file_seek(wdh, 0, SEEK_SET, err) == -1)
+ return FALSE;
if (!wtap_dump_file_write(wdh, &LA_HeaderRegularFake,
sizeof LA_HeaderRegularFake, err))