From 9bdc41a51ad4d7c4accbac0c206731eb8aac55b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Buchm=C3=BCller?= Date: Sun, 8 Jan 2017 03:10:21 +0100 Subject: [PATCH] open-iscsi: apply patch for musl's getopt See #5465 --- srcpkgs/open-iscsi/patches/fix-musl.patch | 40 +++++++++++++++++++++++ srcpkgs/open-iscsi/template | 3 +- 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 srcpkgs/open-iscsi/patches/fix-musl.patch diff --git a/srcpkgs/open-iscsi/patches/fix-musl.patch b/srcpkgs/open-iscsi/patches/fix-musl.patch new file mode 100644 index 00000000000..9fe8406d545 --- /dev/null +++ b/srcpkgs/open-iscsi/patches/fix-musl.patch @@ -0,0 +1,40 @@ +Patch taken from alpinelinux: +http://git.alpinelinux.org/cgit/aports/commit/?id=3d5e7f0642490428f87b2aa499cd830043b42b18 + +Do not rely on optopt for checking if there is an error. +Instead check if getopt() returns a '?' and set a flag +that indicates an argument error. + +Later check this flag and error out, if it is set. + +--- usr/iscsiadm.c 2016-09-29 20:33:24.000000000 +0200 ++++ usr/iscsiadm.c 2017-01-08 03:03:20.648496369 +0100 +@@ -3263,6 +3263,7 @@ + int packet_size=32, ping_count=1, ping_interval=0; + int do_discover = 0, sub_mode = -1; + int portal_type = -1; ++ int argerror = 0; + struct sigaction sa_old; + struct sigaction sa_new; + struct list_head ifaces; +@@ -3426,6 +3427,10 @@ + break; + case 'h': + usage(0); ++ case '?': ++ log_error("unrecognized character '%c'", optopt); ++ argerror = 1; ++ break; + } + + if (name && value) { +@@ -3441,8 +3446,7 @@ + } + } + +- if (optopt) { +- log_error("unrecognized character '%c'", optopt); ++ if (argerror) { + rc = ISCSI_ERR_INVAL; + goto free_ifaces; + } diff --git a/srcpkgs/open-iscsi/template b/srcpkgs/open-iscsi/template index abf09038154..460cbbf0909 100644 --- a/srcpkgs/open-iscsi/template +++ b/srcpkgs/open-iscsi/template @@ -1,7 +1,7 @@ # Template file for 'open-iscsi' pkgname=open-iscsi version=2.0.874 -revision=1 +revision=2 conf_files="/etc/iscsi/iscsid.conf /etc/iscsi/initiatorname.iscsi" build_style=gnu-configure hostmakedepends="automake libtool" @@ -12,7 +12,6 @@ license="GPL-2" homepage="http://www.open-iscsi.com/" distfiles="https://github.com/${pkgname}/${pkgname}/archive/${version}.tar.gz" checksum=d0071bf00fdf6591cd6ea5caf89fa57ada03d263da1f80f17deff76acf7419e1 -#nocross=yes case "$XBPS_TARGET_MACHINE" in *-musl) CFLAGS+="-D_LINUX_IF_ETHER_H";;