Wireshark-dev: [Wireshark-dev] Compilation errors in wiretap/ (without zlib)
From: Jakub Zawadzki <darkjames@xxxxxxxxxxxxxxxx>
Date: Mon, 12 Apr 2010 19:18:34 +0200
Hi,

cause of bug 4606 (zlib-1.2.4 bug) I tried to compile wireshark without zlib:

#v+
netscaler.c: In function 'nstrace_open':
netscaler.c:496: error: comparison between signed and unsigned integer expressions
netscaler.c:532: error: comparison between signed and unsigned integer expressions
netscaler.c: In function 'nspm_signature_version':
netscaler.c:572: error: comparison between signed and unsigned integer expressions
netscaler.c: In function 'nstrace_set_start_time_v10':
netscaler.c:640: error: comparison between signed and unsigned integer expressions
netscaler.c: In function 'nstrace_set_start_time_v20':
netscaler.c:641: error: comparison between signed and unsigned integer expressions
netscaler.c: In function 'nstrace_read_v10':
netscaler.c:777: error: comparison between signed and unsigned integer expressions
netscaler.c: In function 'nstrace_read_v20':
netscaler.c:917: error: comparison between signed and unsigned integer expressions
netscaler.c: In function 'nstrace_seek_read':
netscaler.c:964: error: comparison between signed and unsigned integer expressions

packetlogger.c: In function 'packetlogger_open':
packetlogger.c:70: error: ignoring return value of 'fread', declared with attribute warn_unused_result

vms.c: In function 'parse_vms_hex_dump':
vms.c:492: error: ignoring return value of 'fgets', declared with attribute warn_unused_result
#v-

Attaching patch for vms and packetlogger.
diff --git wiretap/packetlogger.c wiretap/packetlogger.c
index 6907009..021ed12 100644
--- wiretap/packetlogger.c
+++ wiretap/packetlogger.c
@@ -67,7 +67,9 @@ int packetlogger_open(wtap *wth, int *err, gchar **err_info _U_)
 
 	if(!packetlogger_read_header(&pl_hdr, wth->fh, err))
 		return -1;
-	file_read(&type, 1, 1, wth->fh);
+
+	if (file_read(&type, 1, 1, wth->fh) <= 0)
+		return -1;
 
 	/* Verify this file belongs to us */
 	if (!((8 <= pl_hdr.len) && (pl_hdr.len < 65536) &&
diff --git wiretap/vms.c wiretap/vms.c
index 2259948..d24d131 100644
--- wiretap/vms.c
+++ wiretap/vms.c
@@ -489,7 +489,8 @@ parse_vms_hex_dump(FILE_T fh, int pkt_len, guint8* buf, int *err,
     }
     /* Avoid TCPIPTRACE-W-BUFFERSFUL, TCPIPtrace could not save n packets.
      * errors. */
-    file_gets(line, VMS_LINE_LENGTH, fh);
+    if (!file_gets(line, VMS_LINE_LENGTH, fh))
+        return FALSE;
     return TRUE;
 }