libiscsi: fix data segment length comparison to unsigned long

This allows libiscsi to be built on macppc and i386. Also,don't build
with `-Werror'. Hints by sthen@ and jca@ (thanks!).

OK sthen@, "go ahead" Brad (maintainer)
This commit is contained in:
cwen 2020-01-29 11:17:29 +00:00
parent 322bf7acb7
commit 0692573dca
2 changed files with 34 additions and 2 deletions

View File

@ -1,10 +1,11 @@
# $OpenBSD: Makefile,v 1.6 2020/01/26 12:48:36 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.7 2020/01/29 11:17:29 cwen Exp $
COMMENT= client-side library to implement the iSCSI protocol
GH_ACCOUNT= sahlberg
GH_PROJECT= libiscsi
GH_TAGNAME= 1.19.0
REVISION= 0
CATEGORIES= devel net
SHARED_LIBS= iscsi 2.0
@ -21,6 +22,8 @@ WANTLIB= c
AUTOCONF_VERSION= 2.69
AUTOMAKE_VERSION= 1.16
CONFIGURE_STYLE= autoreconf
CONFIGURE_STYLE= autoreconf
CONFIGURE_ARGS+= --disable-werror
.include <bsd.port.mk>

View File

@ -0,0 +1,29 @@
$OpenBSD: patch-lib_login_c,v 1.1 2020/01/29 11:17:30 cwen Exp $
From f2d750260afbb2535d1bd92438e80a80ddb58801 Mon Sep 17 00:00:00 2001
From: Paul Carlisle <paul.carlisle@purestorage.com>
Date: Mon, 27 Jan 2020 16:56:59 -0800
Subject: [PATCH] Fix data segment length comparison to unsigned long
In login.c, data segment parameters in the text segment are converted to
signed longs. Changing from strtol -> strtoul fixes compiler errors on
certain platforms that warn against comparing a signed long with
uint32_t using MIN.
Index: lib/login.c
--- lib/login.c.orig
+++ lib/login.c
@@ -1242,11 +1242,11 @@ iscsi_process_login_reply(struct iscsi_context *iscsi,
/* iSER specific keys */
if (!strncmp(ptr, "InitiatorRecvDataSegmentLength=", 31)) {
- iscsi->initiator_max_recv_data_segment_length = MIN(strtol(ptr + 31, NULL, 10),
+ iscsi->initiator_max_recv_data_segment_length = MIN(strtoul(ptr + 31, NULL, 10),
iscsi->initiator_max_recv_data_segment_length);
}
if (!strncmp(ptr, "TargetRecvDataSegmentLength=", 28)) {
- iscsi->target_max_recv_data_segment_length = MIN(strtol(ptr + 28, NULL, 10),
+ iscsi->target_max_recv_data_segment_length = MIN(strtoul(ptr + 28, NULL, 10),
iscsi->target_max_recv_data_segment_length);
}