void-packages/srcpkgs/open-iscsi/patches/fix-musl.patch
Đoàn Trần Công Danh 2fd8d4df94 srcpkgs/o*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.-][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.-][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

52 lines
1.3 KiB
Diff

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.
--- a/usr/iscsiadm.c 2016-09-29 20:33:24.000000000 +0200
+++ b/usr/iscsiadm.c 2017-01-08 03:03:20.648496369 +0100
@@ -3263,7 +3263,8 @@
int packet_size=32, ping_count=1, ping_interval=0;
int do_discover = 0, sub_mode = -1;
int portal_type = -1;
int timeout = ISCSID_REQ_TIMEOUT;
+ int argerror = 0;
struct sigaction sa_old;
struct sigaction sa_new;
struct list_head ifaces;
@@ -3426,6 +3427,11 @@
break;
case 'h':
usage(0);
+ break;
+ 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;
}
--- a/usr/mgmt_ipc.c
+++ b/usr/mgmt_ipc.c
@@ -22,6 +22,7 @@
* See the file COPYING included with this distribution for more details.
*/
#include <stdlib.h>
+#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <pwd.h>