aboutsummaryrefslogtreecommitdiffstats
path: root/main/musl/0013-fix-lsearch-and-lfind-to-pass-key-as-first-arg-to-th.patch
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2017-03-20 15:25:48 +0200
committerTimo Teräs <timo.teras@iki.fi>2017-03-21 08:15:29 +0200
commit1a4d299a0242a02aa0d4843dd9947d4187e70414 (patch)
tree524965445ca8c9eba7f425db6ffb2035d8025500 /main/musl/0013-fix-lsearch-and-lfind-to-pass-key-as-first-arg-to-th.patch
parentc12931e8863fa9fddc90390db24a4a591f43043e (diff)
downloadaports-1a4d299a0242a02aa0d4843dd9947d4187e70414.tar.bz2
aports-1a4d299a0242a02aa0d4843dd9947d4187e70414.tar.xz
main/musl: cherry-pick upstream fixes
ldso changes (lazy emulation etc) are not stable yet, so it's are not included. the missing patch numbers are for those commits.
Diffstat (limited to 'main/musl/0013-fix-lsearch-and-lfind-to-pass-key-as-first-arg-to-th.patch')
-rw-r--r--main/musl/0013-fix-lsearch-and-lfind-to-pass-key-as-first-arg-to-th.patch41
1 files changed, 41 insertions, 0 deletions
diff --git a/main/musl/0013-fix-lsearch-and-lfind-to-pass-key-as-first-arg-to-th.patch b/main/musl/0013-fix-lsearch-and-lfind-to-pass-key-as-first-arg-to-th.patch
new file mode 100644
index 0000000000..75e3d96ba9
--- /dev/null
+++ b/main/musl/0013-fix-lsearch-and-lfind-to-pass-key-as-first-arg-to-th.patch
@@ -0,0 +1,41 @@
+From 827c4e6fbe46142049ef3d8bcb8f35951712797d Mon Sep 17 00:00:00 2001
+From: Szabolcs Nagy <nsz@port70.net>
+Date: Sun, 5 Mar 2017 23:03:35 +0100
+Subject: [PATCH] fix lsearch and lfind to pass key as first arg to the compar
+ callback
+
+this is not a conformance issue as posix does not specify the
+argument order, but the order is specified for bsearch and some
+systems document the order for lsearch consistently (openbsd).
+
+since there were two indpendent reports of this issue it's better
+to use the more widely expected argument order.
+---
+ src/search/lsearch.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/search/lsearch.c b/src/search/lsearch.c
+index 63f31922..5eb5cc2b 100644
+--- a/src/search/lsearch.c
++++ b/src/search/lsearch.c
+@@ -9,7 +9,7 @@ void *lsearch(const void *key, void *base, size_t *nelp, size_t width,
+ size_t i;
+
+ for (i = 0; i < n; i++)
+- if (compar(p[i], key) == 0)
++ if (compar(key, p[i]) == 0)
+ return p[i];
+ *nelp = n+1;
+ return memcpy(p[n], key, width);
+@@ -23,7 +23,7 @@ void *lfind(const void *key, const void *base, size_t *nelp,
+ size_t i;
+
+ for (i = 0; i < n; i++)
+- if (compar(p[i], key) == 0)
++ if (compar(key, p[i]) == 0)
+ return p[i];
+ return 0;
+ }
+--
+2.11.1
+