wireshark/wireshark-0.99.6-fwrite_unused_result.patch

139 lines
4.5 KiB
Diff

--- wiretap/catapult_dct2000.c
+++ wiretap/catapult_dct2000.c
@@ -578,6 +578,7 @@
guint32 n;
line_prefix_info_t *prefix = NULL;
gchar time_string[16];
+ size_t wr;
/******************************************************/
/* Look up the file_externals structure for this file */
@@ -592,14 +593,14 @@
wdh->dump.dct2000 = g_malloc(sizeof(catapult_dct2000_t));
/* Write out saved first line */
- fwrite(file_externals->firstline, 1, file_externals->firstline_length, wdh->fh);
- fwrite("\n", 1, 1, wdh->fh);
+ wr = fwrite(file_externals->firstline, 1, file_externals->firstline_length, wdh->fh);
+ wr = fwrite("\n", 1, 1, wdh->fh);
/* Also write out saved second line with timestamp corresponding to the
opening time of the log.
*/
- fwrite(file_externals->secondline, 1, file_externals->secondline_length, wdh->fh);
- fwrite("\n", 1, 1, wdh->fh);
+ wr = fwrite(file_externals->secondline, 1, file_externals->secondline_length, wdh->fh);
+ wr = fwrite("\n", 1, 1, wdh->fh);
/* Allocate the dct2000-specific dump structure */
wdh->dump.dct2000 = g_malloc(sizeof(catapult_dct2000_t));
@@ -623,7 +624,7 @@
(const void*)&(pseudo_header->dct2000.seek_off));
/* Write out text before timestamp */
- fwrite(prefix->before_time, 1, strlen(prefix->before_time), wdh->fh);
+ wr = fwrite(prefix->before_time, 1, strlen(prefix->before_time), wdh->fh);
/* Calculate time of this packet to write, relative to start of dump */
if (phdr->ts.nsecs >= wdh->dump.dct2000->start_time.nsecs)
@@ -640,16 +641,16 @@
}
/* Write out the calculated timestamp */
- fwrite(time_string, 1, strlen(time_string), wdh->fh);
+ wr = fwrite(time_string, 1, strlen(time_string), wdh->fh);
/* Write out text between timestamp and start of hex data */
if (prefix->after_time == NULL)
{
- fwrite(" l ", 1, strlen(" l "), wdh->fh);
+ wr = fwrite(" l ", 1, strlen(" l "), wdh->fh);
}
else
{
- fwrite(prefix->after_time, 1, strlen(prefix->after_time), wdh->fh);
+ wr = fwrite(prefix->after_time, 1, strlen(prefix->after_time), wdh->fh);
}
@@ -685,7 +686,7 @@
/**************************************/
/* Remainder is encapsulated protocol */
- fwrite("$", 1, 1, wdh->fh);
+ wr = fwrite("$", 1, 1, wdh->fh);
/* Each binary byte is written out as 2 hex string chars */
for (; n < phdr->len; n++)
@@ -695,11 +696,11 @@
c[1] = char_from_hex((guchar)(pd[n] & 0x0f));
/* Write both hex chars of byte together */
- fwrite(c, 1, 2, wdh->fh);
+ wr = fwrite(c, 1, 2, wdh->fh);
}
/* End the line */
- fwrite("\n", 1, 1, wdh->fh);
+ wr = fwrite("\n", 1, 1, wdh->fh);
return TRUE;
}
--- wiretap/k12.c
+++ wiretap/k12.c
@@ -724,20 +724,21 @@
static const gchar dumpy_junk[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
static void k12_dump_record(wtap_dumper *wdh, long len, guint8* buffer) {
+ size_t wr;
long junky_offset = (0x2000 - ( (wdh->dump.k12->file_offset - 0x200) % 0x2000 )) % 0x2000;
if (len > junky_offset) {
if (junky_offset)
- fwrite(buffer, 1, junky_offset, wdh->fh);
+ wr = fwrite(buffer, 1, junky_offset, wdh->fh);
- fwrite(dumpy_junk, 1, 0x10, wdh->fh);
+ wr = fwrite(dumpy_junk, 1, 0x10, wdh->fh);
- fwrite(buffer+junky_offset, 1, len - junky_offset, wdh->fh);
+ wr = fwrite(buffer+junky_offset, 1, len - junky_offset, wdh->fh);
wdh->dump.k12->file_offset += len + 0x10;
} else {
- fwrite(buffer, 1, len, wdh->fh);
+ wr = fwrite(buffer, 1, len, wdh->fh);
wdh->dump.k12->file_offset += len;
}
@@ -900,12 +901,13 @@
static const guint8 k12_eof[] = {0xff,0xff};
static gboolean k12_dump_close(wtap_dumper *wdh, int *err) {
+ size_t wr;
union {
guint8 b[sizeof(guint32)];
guint32 u;
} d;
- fwrite(k12_eof, 1, 2, wdh->fh);
+ wr = fwrite(k12_eof, 1, 2, wdh->fh);
if (fseek(wdh->fh, 8, SEEK_SET) == -1) {
*err = errno;
@@ -914,11 +918,11 @@
d.u = g_htonl(wdh->dump.k12->file_len);
- fwrite(d.b, 1, 4, wdh->fh);
+ wr = fwrite(d.b, 1, 4, wdh->fh);
d.u = g_htonl(wdh->dump.k12->num_of_records);
- fwrite(d.b, 1, 4, wdh->fh);
+ wr = fwrite(d.b, 1, 4, wdh->fh);
return TRUE;
}