On Wed, 29 Jan 2020 00:09:33 +0100
Charlene Wendling wrote:

> 
> Thanks to sthen@ i've found out that i'm dead wrong, here is some
> better output from clang on i386:
> 
> > login.c:1245:52: error: comparison of integers of different signs:
> > 'long' and 'uint32_t' (aka 'unsigned int') [-Werror,-Wsign-compare]
> 
> Upstream fixed the issue [0] already. That allows libiscsi to be built
> even with `-Werror' set on powerpc, and amd64 is still fine, but it
> still makes sense to not building it with that flag set.
> 
> Comments/feedback are welcome,
> 
> Charlène.
> 
> 
> [0]
> https://github.com/sahlberg/libiscsi/pull/309/commits/f2d750260afbb2535d1bd92438e80a80ddb58801

By sthen@'s request add the full patch header on top of that, so
we know it comes from upstream :) Sorry for the noise.


Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/libiscsi/Makefile,v
retrieving revision 1.6
diff -u -p -u -p -r1.6 Makefile
--- Makefile    26 Jan 2020 12:48:36 -0000      1.6
+++ Makefile    28 Jan 2020 23:29:26 -0000
@@ -5,6 +5,7 @@ COMMENT=        client-side library to implemen
 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>
Index: patches/patch-lib_login_c
===================================================================
RCS file: patches/patch-lib_login_c
diff -N patches/patch-lib_login_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-lib_login_c   28 Jan 2020 23:29:26 -0000
@@ -0,0 +1,29 @@
+$OpenBSD$
+
+From f2d750260afbb2535d1bd92438e80a80ddb58801 Mon Sep 17 00:00:00 2001
+From: Paul Carlisle <paul.carli...@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);
+         }
+ 

Reply via email to