aboutsummaryrefslogtreecommitdiffstats
path: root/main/open-iscsi/musl-fixes.patch
diff options
context:
space:
mode:
authorJann - Ove Risvik <jann.ove@usaklig.com>2016-07-08 03:55:58 +0200
committerBartłomiej Piotrowski <b@bpiotrowski.pl>2016-07-08 09:53:42 +0200
commitec3a1b4087eb88aaa6a7261dff7c2f16d99edf6f (patch)
tree0fc4fff8bced72683b30946433b5cf472e456ae8 /main/open-iscsi/musl-fixes.patch
parentbd1eeeec2bf8b08f1cf8d2a6ce7b36407850fdcd (diff)
downloadaports-ec3a1b4087eb88aaa6a7261dff7c2f16d99edf6f.tar.gz
aports-ec3a1b4087eb88aaa6a7261dff7c2f16d99edf6f.tar.bz2
aports-ec3a1b4087eb88aaa6a7261dff7c2f16d99edf6f.tar.xz
main/open-iscsi: musl fix for error handling. fixes bug #4802
Fixes bug #4802: http://bugs.alpinelinux.org/issues/4802 Seems like iscsiadm relies on checking optopt for checking if there's an error, instead of checking whether opterr is set or if getopt returns '?' and then using optopt to retrieve the option that it didn't recognize. For some reason musl sets optopt to the last option parsed even if it was valid. Is musl supposed to do that? glibc doesn't behave this way. The posix standard for getopt also reads like optopt is only supposed to be set when there's an error. (Only when I was looking for what to put in the email subject line, after I figured it all out did I notice that Brian Angus already submitted a fix earlier. Figured I'd sent this one anyway; that fix removes error output when presented with actual unrecognised arguments.)
Diffstat (limited to 'main/open-iscsi/musl-fixes.patch')
-rw-r--r--main/open-iscsi/musl-fixes.patch24
1 files changed, 24 insertions, 0 deletions
diff --git a/main/open-iscsi/musl-fixes.patch b/main/open-iscsi/musl-fixes.patch
index 35f11e1a59..910b485878 100644
--- a/main/open-iscsi/musl-fixes.patch
+++ b/main/open-iscsi/musl-fixes.patch
@@ -29,3 +29,27 @@
#include <dirent.h>
#include <limits.h>
#include <sys/stat.h>
+--- ./usr/iscsiadm.c.orig
++++ ./usr/iscsiadm.c
+@@ -2553,7 +2553,10 @@ main(int argc, char **argv)
+ return 0;
+ case 'h':
+ usage(0);
+- }
++
++ case '?':
++ log_error("unrecognized character '%c'", optopt);
++ }
+
+ if (name && value) {
+ param = idbm_alloc_user_param(name, value);
+@@ -2568,8 +2571,7 @@ main(int argc, char **argv)
+ }
+ }
+
+- if (optopt) {
+- log_error("unrecognized character '%c'", optopt);
++ if (opterr) {
+ rc = ISCSI_ERR_INVAL;
+ goto free_ifaces;
+ }