summaryrefslogtreecommitdiffstats
path: root/main/musl
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2015-01-14 08:01:05 +0200
committerTimo Teräs <timo.teras@iki.fi>2015-01-14 08:07:37 +0200
commit2f3761dd7844610b10d944820a254e790cdc9f55 (patch)
tree7774b40ba5026700a96a20f106d09eaae48daf2b /main/musl
parent81d3bd83bd6f9afbe529da0e2cde82087d77c570 (diff)
downloadaports-2f3761dd7844610b10d944820a254e790cdc9f55.tar.bz2
aports-2f3761dd7844610b10d944820a254e790cdc9f55.tar.xz
main/musl: upgrade to 1.1.6
All patches or equivalent are upstreamed so remove them all. getopt_long is now doing argument permutation so remove the BSD replacement. Also fixes multiple bugs. ref #3692, ref #3693
Diffstat (limited to 'main/musl')
-rw-r--r--main/musl/0001-manually-shrink-wrap-fast-path-in-pthread_once.patch53
-rw-r--r--main/musl/0002-fix-failure-of-open-to-read-variadic-mode-argument-f.patch26
-rw-r--r--main/musl/0003-fix-invalid-access-by-openat-to-possibly-missing-var.patch38
-rw-r--r--main/musl/0004-fix-uninitialized-mode-variable-in-openat-function.patch27
-rw-r--r--main/musl/0005-math-fix-x86_64-and-x32-asm-not-to-use-sahf-instruct.patch159
-rw-r--r--main/musl/0006-math-use-fnstsw-consistently-instead-of-fstsw-in-x87.patch168
-rw-r--r--main/musl/0007-fix-behavior-of-printf-with-alt-form-octal-zero-prec.patch35
-rw-r--r--main/musl/0008-implement-a-private-state-for-the-uchar.h-functions.patch72
-rw-r--r--main/musl/0009-getopt-fix-optional-argument-processing.patch38
-rw-r--r--main/musl/0010-adapt-dynamic-linker-for-new-binutils-versions-that-.patch31
-rw-r--r--main/musl/0011-add-support-for-non-option-arguments-extension-to-ge.patch71
-rw-r--r--main/musl/0012-fix-uninitialized-output-from-sched_getaffinity.patch39
-rw-r--r--main/musl/0013-fix-return-value-of-pthread_getaffinity_np-and-pthre.patch51
-rw-r--r--main/musl/0014-add-arm-private-syscall-numbers.patch29
-rw-r--r--main/musl/0015-fix-getopt-handling-of-modifier-for-multibyte-option.patch57
-rw-r--r--main/musl/0016-don-t-fail-posix_spawn-on-failed-close.patch30
-rw-r--r--main/musl/0017-use-direct-syscall-rather-than-write-function-in-pos.patch31
-rw-r--r--main/musl/0018-don-t-shadow-functions-with-macros-in-C.patch69
-rw-r--r--main/musl/1001-add-basic-dns-record-parsing-functions.patch246
-rw-r--r--main/musl/1002-implement-FNM_CASEFOLD-gnu-extension.patch114
-rw-r--r--main/musl/1003-remove-ulimit-fiddling-from-setxid.patch72
-rw-r--r--main/musl/APKBUILD102
-rw-r--r--main/musl/getopt_long.c618
23 files changed, 5 insertions, 2171 deletions
diff --git a/main/musl/0001-manually-shrink-wrap-fast-path-in-pthread_once.patch b/main/musl/0001-manually-shrink-wrap-fast-path-in-pthread_once.patch
deleted file mode 100644
index b0e38d844..000000000
--- a/main/musl/0001-manually-shrink-wrap-fast-path-in-pthread_once.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From dc95322e18615392eea69de355edd735a15a8f36 Mon Sep 17 00:00:00 2001
-From: Rich Felker <dalias@aerifal.cx>
-Date: Mon, 20 Oct 2014 00:22:51 -0400
-Subject: [PATCH] manually "shrink wrap" fast path in pthread_once
-
-this change is a workaround for the inability of current compilers to
-perform "shrink wrapping" optimizations. in casual testing, it roughly
-doubled the performance of pthread_once when called on an
-already-finished once control object.
----
- src/thread/pthread_once.c | 20 ++++++++++++--------
- 1 file changed, 12 insertions(+), 8 deletions(-)
-
-diff --git a/src/thread/pthread_once.c b/src/thread/pthread_once.c
-index 7c47385..df655ef 100644
---- a/src/thread/pthread_once.c
-+++ b/src/thread/pthread_once.c
-@@ -8,15 +8,8 @@ static void undo(void *control)
- __wake(control, -1, 1);
- }
-
--int __pthread_once(pthread_once_t *control, void (*init)(void))
-+int __pthread_once_full(pthread_once_t *control, void (*init)(void))
- {
-- /* Return immediately if init finished before, but ensure that
-- * effects of the init routine are visible to the caller. */
-- if (*control == 2) {
-- a_barrier();
-- return 0;
-- }
--
- /* Try to enter initializing state. Four possibilities:
- * 0 - we're the first or the other cancelled; run init
- * 1 - another thread is running init; wait
-@@ -43,4 +36,15 @@ int __pthread_once(pthread_once_t *control, void (*init)(void))
- }
- }
-
-+int __pthread_once(pthread_once_t *control, void (*init)(void))
-+{
-+ /* Return immediately if init finished before, but ensure that
-+ * effects of the init routine are visible to the caller. */
-+ if (*control == 2) {
-+ a_barrier();
-+ return 0;
-+ }
-+ return __pthread_once_full(control, init);
-+}
-+
- weak_alias(__pthread_once, pthread_once);
---
-2.2.0
-
diff --git a/main/musl/0002-fix-failure-of-open-to-read-variadic-mode-argument-f.patch b/main/musl/0002-fix-failure-of-open-to-read-variadic-mode-argument-f.patch
deleted file mode 100644
index 887b38b32..000000000
--- a/main/musl/0002-fix-failure-of-open-to-read-variadic-mode-argument-f.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 9d836ea7a69a6441fcdca815328d274e4ed6b707 Mon Sep 17 00:00:00 2001
-From: Rich Felker <dalias@aerifal.cx>
-Date: Thu, 30 Oct 2014 20:03:56 -0400
-Subject: [PATCH] fix failure of open to read variadic mode argument for
- O_TMPFILE
-
----
- src/fcntl/open.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/fcntl/open.c b/src/fcntl/open.c
-index 5e5be1d..3928a6e 100644
---- a/src/fcntl/open.c
-+++ b/src/fcntl/open.c
-@@ -7,7 +7,7 @@ int open(const char *filename, int flags, ...)
- {
- mode_t mode = 0;
-
-- if (flags & O_CREAT) {
-+ if ((flags & O_CREAT) || (flags & O_TMPFILE) == O_TMPFILE) {
- va_list ap;
- va_start(ap, flags);
- mode = va_arg(ap, mode_t);
---
-2.2.0
-
diff --git a/main/musl/0003-fix-invalid-access-by-openat-to-possibly-missing-var.patch b/main/musl/0003-fix-invalid-access-by-openat-to-possibly-missing-var.patch
deleted file mode 100644
index c6f0340a3..000000000
--- a/main/musl/0003-fix-invalid-access-by-openat-to-possibly-missing-var.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From 2da3ab1382ca8e39eb1e4428103764a81fba73d3 Mon Sep 17 00:00:00 2001
-From: Rich Felker <dalias@aerifal.cx>
-Date: Thu, 30 Oct 2014 20:08:40 -0400
-Subject: [PATCH] fix invalid access by openat to possibly-missing variadic
- mode argument
-
-the mode argument is only required to be present when the O_CREAT or
-O_TMPFILE flag is used.
----
- src/fcntl/openat.c | 12 ++++++++----
- 1 file changed, 8 insertions(+), 4 deletions(-)
-
-diff --git a/src/fcntl/openat.c b/src/fcntl/openat.c
-index 634c4bf..4faeb29 100644
---- a/src/fcntl/openat.c
-+++ b/src/fcntl/openat.c
-@@ -6,10 +6,14 @@
- int openat(int fd, const char *filename, int flags, ...)
- {
- mode_t mode;
-- va_list ap;
-- va_start(ap, flags);
-- mode = va_arg(ap, mode_t);
-- va_end(ap);
-+
-+ if ((flags & O_CREAT) || (flags & O_TMPFILE) == O_TMPFILE) {
-+ va_list ap;
-+ va_start(ap, flags);
-+ mode = va_arg(ap, mode_t);
-+ va_end(ap);
-+ }
-+
- return syscall_cp(SYS_openat, fd, filename, flags|O_LARGEFILE, mode);
- }
-
---
-2.2.0
-
diff --git a/main/musl/0004-fix-uninitialized-mode-variable-in-openat-function.patch b/main/musl/0004-fix-uninitialized-mode-variable-in-openat-function.patch
deleted file mode 100644
index 9385bc7c5..000000000
--- a/main/musl/0004-fix-uninitialized-mode-variable-in-openat-function.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From e146e6035fecea080fb17450db3c8bb44d36e07d Mon Sep 17 00:00:00 2001
-From: Rich Felker <dalias@aerifal.cx>
-Date: Fri, 31 Oct 2014 15:35:24 -0400
-Subject: [PATCH] fix uninitialized mode variable in openat function
-
-this was introduced in commit 2da3ab1382ca8e39eb1e4428103764a81fba73d3
-as an oversight while making the variadic argument access conditional.
----
- src/fcntl/openat.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/fcntl/openat.c b/src/fcntl/openat.c
-index 4faeb29..e741336 100644
---- a/src/fcntl/openat.c
-+++ b/src/fcntl/openat.c
-@@ -5,7 +5,7 @@
-
- int openat(int fd, const char *filename, int flags, ...)
- {
-- mode_t mode;
-+ mode_t mode = 0;
-
- if ((flags & O_CREAT) || (flags & O_TMPFILE) == O_TMPFILE) {
- va_list ap;
---
-2.2.0
-
diff --git a/main/musl/0005-math-fix-x86_64-and-x32-asm-not-to-use-sahf-instruct.patch b/main/musl/0005-math-fix-x86_64-and-x32-asm-not-to-use-sahf-instruct.patch
deleted file mode 100644
index 807536be4..000000000
--- a/main/musl/0005-math-fix-x86_64-and-x32-asm-not-to-use-sahf-instruct.patch
+++ /dev/null
@@ -1,159 +0,0 @@
-From a732e80d33b4fd6f510f7cec4f5573ef5d89bc4e Mon Sep 17 00:00:00 2001
-From: Szabolcs Nagy <nsz@port70.net>
-Date: Wed, 5 Nov 2014 21:40:29 +0100
-Subject: [PATCH] math: fix x86_64 and x32 asm not to use sahf instruction
-
-Some early x86_64 cpus (released before 2006) did not support sahf/lahf
-instructions so they should be avoided (intel manual says they are only
-supported if CPUID.80000001H:ECX.LAHF-SAHF[bit 0] = 1).
-
-The workaround simplifies exp2l and expm1l because fucomip can be
-used instead of the fucomp;fnstsw;sahf sequence copied from i386.
-
-In fmodl and remainderl sahf is replaced by a simple bit test.
----
- src/math/x32/exp2l.s | 13 +++----------
- src/math/x32/fmodl.s | 4 ++--
- src/math/x32/remainderl.s | 4 ++--
- src/math/x86_64/exp2l.s | 13 +++----------
- src/math/x86_64/fmodl.s | 4 ++--
- src/math/x86_64/remainderl.s | 4 ++--
- 6 files changed, 14 insertions(+), 28 deletions(-)
-
-diff --git a/src/math/x32/exp2l.s b/src/math/x32/exp2l.s
-index d9f4d6e..dfb2bc7 100644
---- a/src/math/x32/exp2l.s
-+++ b/src/math/x32/exp2l.s
-@@ -6,9 +6,7 @@ expm1l:
- fmulp
- movl $0xc2820000,-4(%esp)
- flds -4(%esp)
-- fucomp %st(1)
-- fnstsw %ax
-- sahf
-+ fucomip %st(1)
- fld1
- jb 1f
- # x*log2e <= -65, return -1 without underflow
-@@ -17,11 +15,8 @@ expm1l:
- ret
- 1: fld %st(1)
- fabs
-- fucom %st(1)
-- fnstsw %ax
-+ fucomip %st(1)
- fstp %st(0)
-- fstp %st(0)
-- sahf
- ja 1f
- f2xm1
- ret
-@@ -53,9 +48,7 @@ exp2l:
- fld %st(1)
- fsub %st(1)
- faddp
-- fucomp %st(1)
-- fnstsw
-- sahf
-+ fucomip %st(1)
- je 2f # x - 0x1p63 + 0x1p63 == x
- movl $1,(%esp)
- flds (%esp) # 0x1p-149
-diff --git a/src/math/x32/fmodl.s b/src/math/x32/fmodl.s
-index 9e4378a..b951320 100644
---- a/src/math/x32/fmodl.s
-+++ b/src/math/x32/fmodl.s
-@@ -5,7 +5,7 @@ fmodl:
- fldt 8(%esp)
- 1: fprem
- fstsw %ax
-- sahf
-- jp 1b
-+ testb $4,%ah
-+ jnz 1b
- fstp %st(1)
- ret
-diff --git a/src/math/x32/remainderl.s b/src/math/x32/remainderl.s
-index c97f68a..79bf4fe 100644
---- a/src/math/x32/remainderl.s
-+++ b/src/math/x32/remainderl.s
-@@ -5,7 +5,7 @@ remainderl:
- fldt 8(%esp)
- 1: fprem1
- fstsw %ax
-- sahf
-- jp 1b
-+ testb $4,%ah
-+ jnz 1b
- fstp %st(1)
- ret
-diff --git a/src/math/x86_64/exp2l.s b/src/math/x86_64/exp2l.s
-index 0d6cd56..0e9bdf9 100644
---- a/src/math/x86_64/exp2l.s
-+++ b/src/math/x86_64/exp2l.s
-@@ -6,9 +6,7 @@ expm1l:
- fmulp
- movl $0xc2820000,-4(%rsp)
- flds -4(%rsp)
-- fucomp %st(1)
-- fnstsw %ax
-- sahf
-+ fucomip %st(1)
- fld1
- jb 1f
- # x*log2e <= -65, return -1 without underflow
-@@ -17,11 +15,8 @@ expm1l:
- ret
- 1: fld %st(1)
- fabs
-- fucom %st(1)
-- fnstsw %ax
-+ fucomip %st(1)
- fstp %st(0)
-- fstp %st(0)
-- sahf
- ja 1f
- f2xm1
- ret
-@@ -53,9 +48,7 @@ exp2l:
- fld %st(1)
- fsub %st(1)
- faddp
-- fucomp %st(1)
-- fnstsw
-- sahf
-+ fucomip %st(1)
- je 2f # x - 0x1p63 + 0x1p63 == x
- movl $1,(%rsp)
- flds (%rsp) # 0x1p-149
-diff --git a/src/math/x86_64/fmodl.s b/src/math/x86_64/fmodl.s
-index ca81e60..cd8d2b7 100644
---- a/src/math/x86_64/fmodl.s
-+++ b/src/math/x86_64/fmodl.s
-@@ -5,7 +5,7 @@ fmodl:
- fldt 8(%rsp)
- 1: fprem
- fstsw %ax
-- sahf
-- jp 1b
-+ testb $4,%ah
-+ jnz 1b
- fstp %st(1)
- ret
-diff --git a/src/math/x86_64/remainderl.s b/src/math/x86_64/remainderl.s
-index 75c1237..2c337cf 100644
---- a/src/math/x86_64/remainderl.s
-+++ b/src/math/x86_64/remainderl.s
-@@ -5,7 +5,7 @@ remainderl:
- fldt 8(%rsp)
- 1: fprem1
- fstsw %ax
-- sahf
-- jp 1b
-+ testb $4,%ah
-+ jnz 1b
- fstp %st(1)
- ret
---
-2.2.0
-
diff --git a/main/musl/0006-math-use-fnstsw-consistently-instead-of-fstsw-in-x87.patch b/main/musl/0006-math-use-fnstsw-consistently-instead-of-fstsw-in-x87.patch
deleted file mode 100644
index 2bd9dcd55..000000000
--- a/main/musl/0006-math-use-fnstsw-consistently-instead-of-fstsw-in-x87.patch
+++ /dev/null
@@ -1,168 +0,0 @@
-From ec4318943a26d4bd4050481d11709853184f2794 Mon Sep 17 00:00:00 2001
-From: Szabolcs Nagy <nsz@port70.net>
-Date: Wed, 5 Nov 2014 22:13:58 +0100
-Subject: [PATCH] math: use fnstsw consistently instead of fstsw in x87 asm
-
-fnstsw does not wait for pending unmasked x87 floating-point exceptions
-and it is the same as fstsw when all exceptions are masked which is the
-only environment libc supports.
----
- src/math/i386/fmod.s | 2 +-
- src/math/i386/fmodf.s | 2 +-
- src/math/i386/fmodl.s | 2 +-
- src/math/i386/remainder.s | 2 +-
- src/math/i386/remainderf.s | 2 +-
- src/math/i386/remainderl.s | 2 +-
- src/math/i386/sqrt.s | 2 +-
- src/math/x32/fmodl.s | 2 +-
- src/math/x32/remainderl.s | 2 +-
- src/math/x86_64/fmodl.s | 2 +-
- src/math/x86_64/remainderl.s | 2 +-
- 11 files changed, 11 insertions(+), 11 deletions(-)
-
-diff --git a/src/math/i386/fmod.s b/src/math/i386/fmod.s
-index 069fbfe..2113b3c 100644
---- a/src/math/i386/fmod.s
-+++ b/src/math/i386/fmod.s
-@@ -4,7 +4,7 @@ fmod:
- fldl 12(%esp)
- fldl 4(%esp)
- 1: fprem
-- fstsw %ax
-+ fnstsw %ax
- sahf
- jp 1b
- fstp %st(1)
-diff --git a/src/math/i386/fmodf.s b/src/math/i386/fmodf.s
-index d99c80f..e04e2a5 100644
---- a/src/math/i386/fmodf.s
-+++ b/src/math/i386/fmodf.s
-@@ -4,7 +4,7 @@ fmodf:
- flds 8(%esp)
- flds 4(%esp)
- 1: fprem
-- fstsw %ax
-+ fnstsw %ax
- sahf
- jp 1b
- fstp %st(1)
-diff --git a/src/math/i386/fmodl.s b/src/math/i386/fmodl.s
-index 7e07e7b..0cb3fe9 100644
---- a/src/math/i386/fmodl.s
-+++ b/src/math/i386/fmodl.s
-@@ -4,7 +4,7 @@ fmodl:
- fldt 16(%esp)
- fldt 4(%esp)
- 1: fprem
-- fstsw %ax
-+ fnstsw %ax
- sahf
- jp 1b
- fstp %st(1)
-diff --git a/src/math/i386/remainder.s b/src/math/i386/remainder.s
-index 7f4be05..ab1da95 100644
---- a/src/math/i386/remainder.s
-+++ b/src/math/i386/remainder.s
-@@ -7,7 +7,7 @@ drem:
- fldl 12(%esp)
- fldl 4(%esp)
- 1: fprem1
-- fstsw %ax
-+ fnstsw %ax
- sahf
- jp 1b
- fstp %st(1)
-diff --git a/src/math/i386/remainderf.s b/src/math/i386/remainderf.s
-index ac6e367..6a7378a 100644
---- a/src/math/i386/remainderf.s
-+++ b/src/math/i386/remainderf.s
-@@ -7,7 +7,7 @@ dremf:
- flds 8(%esp)
- flds 4(%esp)
- 1: fprem1
-- fstsw %ax
-+ fnstsw %ax
- sahf
- jp 1b
- fstp %st(1)
-diff --git a/src/math/i386/remainderl.s b/src/math/i386/remainderl.s
-index 0097872..b41518e 100644
---- a/src/math/i386/remainderl.s
-+++ b/src/math/i386/remainderl.s
-@@ -4,7 +4,7 @@ remainderl:
- fldt 16(%esp)
- fldt 4(%esp)
- 1: fprem1
-- fstsw %ax
-+ fnstsw %ax
- sahf
- jp 1b
- fstp %st(1)
-diff --git a/src/math/i386/sqrt.s b/src/math/i386/sqrt.s
-index 8289d09..57837e2 100644
---- a/src/math/i386/sqrt.s
-+++ b/src/math/i386/sqrt.s
-@@ -2,7 +2,7 @@
- .type sqrt,@function
- sqrt: fldl 4(%esp)
- fsqrt
-- fstsw %ax
-+ fnstsw %ax
- sub $12,%esp
- fld %st(0)
- fstpt (%esp)
-diff --git a/src/math/x32/fmodl.s b/src/math/x32/fmodl.s
-index b951320..c3f790c 100644
---- a/src/math/x32/fmodl.s
-+++ b/src/math/x32/fmodl.s
-@@ -4,7 +4,7 @@ fmodl:
- fldt 24(%esp)
- fldt 8(%esp)
- 1: fprem
-- fstsw %ax
-+ fnstsw %ax
- testb $4,%ah
- jnz 1b
- fstp %st(1)
-diff --git a/src/math/x32/remainderl.s b/src/math/x32/remainderl.s
-index 79bf4fe..376ba0e 100644
---- a/src/math/x32/remainderl.s
-+++ b/src/math/x32/remainderl.s
-@@ -4,7 +4,7 @@ remainderl:
- fldt 24(%esp)
- fldt 8(%esp)
- 1: fprem1
-- fstsw %ax
-+ fnstsw %ax
- testb $4,%ah
- jnz 1b
- fstp %st(1)
-diff --git a/src/math/x86_64/fmodl.s b/src/math/x86_64/fmodl.s
-index cd8d2b7..ea07b40 100644
---- a/src/math/x86_64/fmodl.s
-+++ b/src/math/x86_64/fmodl.s
-@@ -4,7 +4,7 @@ fmodl:
- fldt 24(%rsp)
- fldt 8(%rsp)
- 1: fprem
-- fstsw %ax
-+ fnstsw %ax
- testb $4,%ah
- jnz 1b
- fstp %st(1)
-diff --git a/src/math/x86_64/remainderl.s b/src/math/x86_64/remainderl.s
-index 2c337cf..cb3857b 100644
---- a/src/math/x86_64/remainderl.s
-+++ b/src/math/x86_64/remainderl.s
-@@ -4,7 +4,7 @@ remainderl:
- fldt 24(%rsp)
- fldt 8(%rsp)
- 1: fprem1
-- fstsw %ax
-+ fnstsw %ax
- testb $4,%ah
- jnz 1b
- fstp %st(1)
---
-2.2.0
-
diff --git a/main/musl/0007-fix-behavior-of-printf-with-alt-form-octal-zero-prec.patch b/main/musl/0007-fix-behavior-of-printf-with-alt-form-octal-zero-prec.patch
deleted file mode 100644
index c58122cfa..000000000
--- a/main/musl/0007-fix-behavior-of-printf-with-alt-form-octal-zero-prec.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From b91cdbe2bc8b626aa04dc6e3e84345accf34e4b1 Mon Sep 17 00:00:00 2001
-From: Rich Felker <dalias@aerifal.cx>
-Date: Sat, 15 Nov 2014 12:16:19 -0500
-Subject: [PATCH] fix behavior of printf with alt-form octal, zero precision,
- zero value
-
-in this case there are two conflicting rules in play: that an explicit
-precision of zero with the value zero produces no output, and that the
-'#' modifier for octal increases the precision sufficiently to yield a
-leading zero. ISO C (7.19.6.1 paragraph 6 in C99+TC3) includes a
-parenthetical remark to clarify that the precision-increasing behavior
-takes precedence, but the corresponding text in POSIX off of which I
-based the implementation is missing this remark.
-
-this issue was covered in WG14 DR#151.
----
- src/stdio/vfprintf.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c
-index ea25772..39c1e86 100644
---- a/src/stdio/vfprintf.c
-+++ b/src/stdio/vfprintf.c
-@@ -570,7 +570,7 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg,
- if (0) {
- case 'o':
- a = fmt_o(arg.i, z);
-- if ((fl&ALT_FORM) && arg.i) prefix+=5, pl=1;
-+ if ((fl&ALT_FORM) && p<z-a+1) p=z-a+1;
- } if (0) {
- case 'd': case 'i':
- pl=1;
---
-2.2.0
-
diff --git a/main/musl/0008-implement-a-private-state-for-the-uchar.h-functions.patch b/main/musl/0008-implement-a-private-state-for-the-uchar.h-functions.patch
deleted file mode 100644
index 5dfdae204..000000000
--- a/main/musl/0008-implement-a-private-state-for-the-uchar.h-functions.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 941644e98c3d05761b4639a8ae5afacd8586d1b9 Mon Sep 17 00:00:00 2001
-From: Jens Gustedt <Jens.Gustedt@inria.fr>
-Date: Sun, 9 Nov 2014 11:18:08 +0100
-Subject: [PATCH] implement a private state for the uchar.h functions
-
-The C standard is imperative on that:
-
- 7.28.1 ... If ps is a null pointer, each function uses its own internal
- mbstate_t object instead, which is initialized at program startup to
- the initial conversion state;
-
-and these functions are also not supposed to implicitly use the state of
-the wchar.h functions:
-
- 7.29.6.3 ... The implementation behaves as if no library function calls
- these functions with a null pointer for ps.
-
-Previously this resulted in two bugs.
-
- - The functions c16rtomb and mbrtoc16 would crash when called with ps
- set to null.
-
- - The function mbrtoc32 used the private state of mbrtowc, which it
- is not allowed to do.
----
- src/multibyte/c16rtomb.c | 2 ++
- src/multibyte/mbrtoc16.c | 2 ++
- src/multibyte/mbrtoc32.c | 2 ++
- 3 files changed, 6 insertions(+)
-
-diff --git a/src/multibyte/c16rtomb.c b/src/multibyte/c16rtomb.c
-index 2e8ec97..39ca375 100644
---- a/src/multibyte/c16rtomb.c
-+++ b/src/multibyte/c16rtomb.c
-@@ -4,6 +4,8 @@
-
- size_t c16rtomb(char *restrict s, char16_t c16, mbstate_t *restrict ps)
- {
-+ static unsigned internal_state;
-+ if (!ps) ps = (void *)&internal_state;
- unsigned *x = (unsigned *)ps;
- wchar_t wc;
-
-diff --git a/src/multibyte/mbrtoc16.c b/src/multibyte/mbrtoc16.c
-index 74b7d77..765ff90 100644
---- a/src/multibyte/mbrtoc16.c
-+++ b/src/multibyte/mbrtoc16.c
-@@ -3,6 +3,8 @@
-
- size_t mbrtoc16(char16_t *restrict pc16, const char *restrict s, size_t n, mbstate_t *restrict ps)
- {
-+ static unsigned internal_state;
-+ if (!ps) ps = (void *)&internal_state;
- unsigned *pending = (unsigned *)ps;
-
- if (!s) return mbrtoc16(0, "", 1, ps);
-diff --git a/src/multibyte/mbrtoc32.c b/src/multibyte/mbrtoc32.c
-index c6d2082..9b6b236 100644
---- a/src/multibyte/mbrtoc32.c
-+++ b/src/multibyte/mbrtoc32.c
-@@ -3,6 +3,8 @@
-
- size_t mbrtoc32(char32_t *restrict pc32, const char *restrict s, size_t n, mbstate_t *restrict ps)
- {
-+ static unsigned internal_state;
-+ if (!ps) ps = (void *)&internal_state;
- if (!s) return mbrtoc32(0, "", 1, ps);
- wchar_t wc;
- size_t ret = mbrtowc(&wc, s, n, ps);
---
-2.2.0
-
diff --git a/main/musl/0009-getopt-fix-optional-argument-processing.patch b/main/musl/0009-getopt-fix-optional-argument-processing.patch
deleted file mode 100644
index e486d0c5d..000000000
--- a/main/musl/0009-getopt-fix-optional-argument-processing.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From acccc93e084641861ca553317edb7da7791833b5 Mon Sep 17 00:00:00 2001
-From: Felix Fietkau <nbd@openwrt.org>
-Date: Tue, 21 Oct 2014 22:24:50 +0200
-Subject: [PATCH] getopt: fix optional argument processing
-
-Processing an option character with optional argument fails if the
-option is last on the command line. This happens because the
-if (optind >= argc) check runs first before testing for optional
-argument.
----
- src/misc/getopt.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/src/misc/getopt.c b/src/misc/getopt.c
-index 8a2e4d5..f94c4f7 100644
---- a/src/misc/getopt.c
-+++ b/src/misc/getopt.c
-@@ -55,7 +55,8 @@ int getopt(int argc, char * const argv[], const char *optstring)
- return '?';
- }
- if (optstring[i+1] == ':') {
-- if (optind >= argc) {
-+ if (optstring[i+2] == ':') optarg = 0;
-+ else if (optind >= argc) {
- if (optstring[0] == ':') return ':';
- if (opterr) {
- write(2, argv[0], strlen(argv[0]));
-@@ -65,7 +66,6 @@ int getopt(int argc, char * const argv[], const char *optstring)
- }
- return '?';
- }
-- if (optstring[i+2] == ':') optarg = 0;
- if (optstring[i+2] != ':' || optpos) {
- optarg = argv[optind++] + optpos;
- optpos = 0;
---
-2.2.0
-
diff --git a/main/musl/0010-adapt-dynamic-linker-for-new-binutils-versions-that-.patch b/main/musl/0010-adapt-dynamic-linker-for-new-binutils-versions-that-.patch
deleted file mode 100644
index 07a7083bf..000000000
--- a/main/musl/0010-adapt-dynamic-linker-for-new-binutils-versions-that-.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From d8dc2b7c0289b12eeef4feff65e3c918111b0f55 Mon Sep 17 00:00:00 2001
-From: Rich Felker <dalias@aerifal.cx>
-Date: Sun, 23 Nov 2014 16:17:57 -0500
-Subject: [PATCH] adapt dynamic linker for new binutils versions that omit
- DT_RPATH
-
-the new DT_RUNPATH semantics for search order are always used, and
-since binutils had always set both DT_RPATH and DT_RUNPATH when the
-latter was used, processing only DT_RPATH worked fine. however, recent
-binutils has stopped generating DT_RPATH when DT_RUNPATH is used,
-which broke support for this feature completely.
----
- src/ldso/dynlink.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c
-index 1de430c..00af886 100644
---- a/src/ldso/dynlink.c
-+++ b/src/ldso/dynlink.c
-@@ -645,6 +645,8 @@ static void decode_dyn(struct dso *p)
- p->hashtab = (void *)(p->base + dyn[DT_HASH]);
- if (dyn[0]&(1<<DT_RPATH))
- p->rpath_orig = (void *)(p->strings + dyn[DT_RPATH]);
-+ if (dyn[0]&(1<<DT_RUNPATH))
-+ p->rpath_orig = (void *)(p->strings + dyn[DT_RUNPATH]);
- if (search_vec(p->dynv, dyn, DT_GNU_HASH))
- p->ghashtab = (void *)(p->base + *dyn);
- if (search_vec(p->dynv, dyn, DT_VERSYM))
---
-2.2.0
-
diff --git a/main/musl/0011-add-support-for-non-option-arguments-extension-to-ge.patch b/main/musl/0011-add-support-for-non-option-arguments-extension-to-ge.patch
deleted file mode 100644
index 7bf8e75e8..000000000
--- a/main/musl/0011-add-support-for-non-option-arguments-extension-to-ge.patch
+++ /dev/null
@@ -1,71 +0,0 @@
-From b72cd07f176b876aa51864d93aa8101477b1d732 Mon Sep 17 00:00:00 2001
-From: Gianluca Anzolin <gianluca@sottospazio.it>
-Date: Tue, 25 Nov 2014 08:56:03 +0100
-Subject: [PATCH] add support for non-option arguments extension to getopt
-
-this is a GNU extension, activated by including '-' as the first
-character of the options string, whereby non-option arguments are
-processed as if they were arguments to an option character '\1' rather
-than ending option processing.
----
- src/misc/getopt.c | 17 ++++++++++++++++-
- src/misc/getopt_long.c | 7 ++++---
- 2 files changed, 20 insertions(+), 4 deletions(-)
-
-diff --git a/src/misc/getopt.c b/src/misc/getopt.c
-index f94c4f7..a698c8d 100644
---- a/src/misc/getopt.c
-+++ b/src/misc/getopt.c
-@@ -24,8 +24,20 @@ int getopt(int argc, char * const argv[], const char *optstring)
- optind = 1;
- }
-
-- if (optind >= argc || !argv[optind] || argv[optind][0] != '-' || !argv[optind][1])
-+ if (optind >= argc || !argv[optind])
- return -1;
-+
-+ if (argv[optind][0] != '-') {
-+ if (optstring[0] == '-') {
-+ optarg = argv[optind++];
-+ return 1;
-+ }
-+ return -1;
-+ }
-+
-+ if (!argv[optind][1])
-+ return -1;
-+
- if (argv[optind][1] == '-' && !argv[optind][2])
- return optind++, -1;
-
-@@ -43,6 +55,9 @@ int getopt(int argc, char * const argv[], const char *optstring)
- optpos = 0;
- }
-
-+ if (optstring[0] == '-')
-+ optstring++;
-+
- for (i=0; (l = mbtowc(&d, optstring+i, MB_LEN_MAX)) && d!=c; i+=l>0?l:1);
-
- if (d != c) {
-diff --git a/src/misc/getopt_long.c b/src/misc/getopt_long.c
-index 4ef5a5c..3d318ce 100644
---- a/src/misc/getopt_long.c
-+++ b/src/misc/getopt_long.c
-@@ -12,9 +12,10 @@ static int __getopt_long(int argc, char *const *argv, const char *optstring, con
- __optpos = 0;
- optind = 1;
- }
-- if (optind >= argc || !argv[optind] || argv[optind][0] != '-') return -1;
-- if ((longonly && argv[optind][1]) ||
-- (argv[optind][1] == '-' && argv[optind][2]))
-+ if (optind >= argc || !argv[optind]) return -1;
-+ if (argv[optind][0] == '-' &&
-+ ((longonly && argv[optind][1]) ||
-+ (argv[optind][1] == '-' && argv[optind][2])))
- {
- int i;
- for (i=0; longopts[i].name; i++) {
---
-2.2.0
-
diff --git a/main/musl/0012-fix-uninitialized-output-from-sched_getaffinity.patch b/main/musl/0012-fix-uninitialized-output-from-sched_getaffinity.patch
deleted file mode 100644
index 8e99597be..000000000
--- a/main/musl/0012-fix-uninitialized-output-from-sched_getaffinity.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From a56e339419c1a90f8a85f86621f3c73945e07b23 Mon Sep 17 00:00:00 2001
-From: Rich Felker <dalias@aerifal.cx>
-Date: Tue, 2 Dec 2014 21:54:36 -0500
-Subject: [PATCH] fix uninitialized output from sched_getaffinity
-
-the sched_getaffinity syscall only fills a cpu set up to the set size
-used/supported by the kernel. the rest is left untouched and userspace
-is responsible for zero-filling it based on the return value of the
-syscall.
----
- src/sched/affinity.c | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
-
-diff --git a/src/sched/affinity.c b/src/sched/affinity.c
-index 3b40211..737e41b 100644
---- a/src/sched/affinity.c
-+++ b/src/sched/affinity.c
-@@ -1,5 +1,6 @@
- #define _GNU_SOURCE
- #include <sched.h>
-+#include <string.h>
- #include "pthread_impl.h"
- #include "syscall.h"
-
-@@ -16,7 +17,10 @@ int pthread_setaffinity_np(pthread_t td, size_t size, const cpu_set_t *set)
- int sched_getaffinity(pid_t tid, size_t size, cpu_set_t *set)
- {
- long ret = __syscall(SYS_sched_getaffinity, tid, size, set);
-- if (ret > 0) ret = 0;
-+ if (ret > 0) {
-+ if (ret < size) memset((char *)set+ret, 0, size-ret);
-+ ret = 0;
-+ }
- return __syscall_ret(ret);
- }
-
---
-2.2.0
-
diff --git a/main/musl/0013-fix-return-value-of-pthread_getaffinity_np-and-pthre.patch b/main/musl/0013-fix-return-value-of-pthread_getaffinity_np-and-pthre.patch
deleted file mode 100644
index a38ab2f49..000000000
--- a/main/musl/0013-fix-return-value-of-pthread_getaffinity_np-and-pthre.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From 66140b0c926ed097f2cb7474863523e4af351f5b Mon Sep 17 00:00:00 2001
-From: Rich Felker <dalias@aerifal.cx>
-Date: Tue, 2 Dec 2014 22:17:52 -0500
-Subject: [PATCH] fix return value of pthread_getaffinity_np and
- pthread_setaffinity_np
-
-these functions are expected to return an error code rather than
-setting errno and returning -1.
----
- src/sched/affinity.c | 19 +++++++++++--------
- 1 file changed, 11 insertions(+), 8 deletions(-)
-
-diff --git a/src/sched/affinity.c b/src/sched/affinity.c
-index 737e41b..948ece4 100644
---- a/src/sched/affinity.c
-+++ b/src/sched/affinity.c
-@@ -11,20 +11,23 @@ int sched_setaffinity(pid_t tid, size_t size, const cpu_set_t *set)
-
- int pthread_setaffinity_np(pthread_t td, size_t size, const cpu_set_t *set)
- {
-- return syscall(SYS_sched_setaffinity, td->tid, size, set);
-+ return -__syscall(SYS_sched_setaffinity, td->tid, size, set);
- }
-
--int sched_getaffinity(pid_t tid, size_t size, cpu_set_t *set)
-+static int do_getaffinity(pid_t tid, size_t size, cpu_set_t *set)
- {
- long ret = __syscall(SYS_sched_getaffinity, tid, size, set);
-- if (ret > 0) {
-- if (ret < size) memset((char *)set+ret, 0, size-ret);
-- ret = 0;
-- }
-- return __syscall_ret(ret);
-+ if (ret < 0) return ret;
-+ if (ret < size) memset((char *)set+ret, 0, size-ret);
-+ return 0;
-+}
-+
-+int sched_getaffinity(pid_t tid, size_t size, cpu_set_t *set)
-+{
-+ return __syscall_ret(do_getaffinity(tid, size, set));
- }
-
- int pthread_getaffinity_np(pthread_t td, size_t size, cpu_set_t *set)
- {
-- return sched_getaffinity(td->tid, size, set);
-+ return -do_getaffinity(td->tid, size, set);
- }
---
-2.2.0
-
diff --git a/main/musl/0014-add-arm-private-syscall-numbers.patch b/main/musl/0014-add-arm-private-syscall-numbers.patch
deleted file mode 100644
index 408b65d79..000000000
--- a/main/musl/0014-add-arm-private-syscall-numbers.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From be1f67ab6fde1989af7b2e2946804e9009931a8a Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
-Date: Wed, 3 Dec 2014 16:09:37 +0200
-Subject: [PATCH] add arm private syscall numbers
-
-it is part of kernel uapi, and some programs (e.g. nodejs) do use them
----
- arch/arm/bits/syscall.h | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/arch/arm/bits/syscall.h b/arch/arm/bits/syscall.h
-index d1b1c99..df23b83 100644
---- a/arch/arm/bits/syscall.h
-+++ b/arch/arm/bits/syscall.h
-@@ -340,6 +340,11 @@
- #define __NR_getrandom 384
- #define __NR_memfd_create 385
-
-+#define __ARM_NR_breakpoint 0x0f0001
-+#define __ARM_NR_cacheflush 0x0f0002
-+#define __ARM_NR_usr26 0x0f0003
-+#define __ARM_NR_usr32 0x0f0004
-+#define __ARM_NR_set_tls 0x0f0005
-
- /* Repeated with SYS_ prefix */
-
---
-2.2.0
-
diff --git a/main/musl/0015-fix-getopt-handling-of-modifier-for-multibyte-option.patch b/main/musl/0015-fix-getopt-handling-of-modifier-for-multibyte-option.patch
deleted file mode 100644
index dc4130472..000000000
--- a/main/musl/0015-fix-getopt-handling-of-modifier-for-multibyte-option.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-From 014275b547e3059db5c45986408757c250e8198d Mon Sep 17 00:00:00 2001
-From: Rich Felker <dalias@aerifal.cx>
-Date: Thu, 4 Dec 2014 10:23:33 -0500
-Subject: [PATCH] fix getopt handling of ':' modifier for multibyte option
- characters
-
-the previous hard-coded offsets of +1 and +2 contained a hidden
-assumption that the option character matched was single-byte, despite
-this implementation of getopt attempting to support multibyte option
-characters. this patch reworks the matching logic to leave the final
-index pointing just past the matched character so that fixed offsets
-can be used to check for ':'.
----
- src/misc/getopt.c | 13 +++++++++----
- 1 file changed, 9 insertions(+), 4 deletions(-)
-
-diff --git a/src/misc/getopt.c b/src/misc/getopt.c
-index a698c8d..52aa7a3 100644
---- a/src/misc/getopt.c
-+++ b/src/misc/getopt.c
-@@ -58,7 +58,12 @@ int getopt(int argc, char * const argv[], const char *optstring)
- if (optstring[0] == '-')
- optstring++;
-
-- for (i=0; (l = mbtowc(&d, optstring+i, MB_LEN_MAX)) && d!=c; i+=l>0?l:1);
-+ i = 0;
-+ d = 0;
-+ do {
-+ l = mbtowc(&d, optstring+i, MB_LEN_MAX);
-+ if (l>0) i+=l; else i++;
-+ } while (l && d != c);
-
- if (d != c) {
- if (optstring[0] != ':' && opterr) {
-@@ -69,8 +74,8 @@ int getopt(int argc, char * const argv[], const char *optstring)
- }
- return '?';
- }
-- if (optstring[i+1] == ':') {
-- if (optstring[i+2] == ':') optarg = 0;
-+ if (optstring[i] == ':') {
-+ if (optstring[i+1] == ':') optarg = 0;
- else if (optind >= argc) {
- if (optstring[0] == ':') return ':';
- if (opterr) {
-@@ -81,7 +86,7 @@ int getopt(int argc, char * const argv[], const char *optstring)
- }
- return '?';
- }
-- if (optstring[i+2] != ':' || optpos) {
-+ if (optstring[i+1] != ':' || optpos) {
- optarg = argv[optind++] + optpos;
- optpos = 0;
- }
---
-2.2.0
-
diff --git a/main/musl/0016-don-t-fail-posix_spawn-on-failed-close.patch b/main/musl/0016-don-t-fail-posix_spawn-on-failed-close.patch
deleted file mode 100644
index b7aff4f61..000000000
--- a/main/musl/0016-don-t-fail-posix_spawn-on-failed-close.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 1c12c24364d1058ffdbb28fca72a51de85082778 Mon Sep 17 00:00:00 2001
-From: Rich Felker <dalias@aerifal.cx>
-Date: Fri, 5 Dec 2014 21:15:41 -0500
-Subject: [PATCH] don't fail posix_spawn on failed close
-
-the resolution of austin group issue #370 removes the requirement that
-posix_spawn fail when the close file action is performed on an
-already-closed fd. since there are no other meaningful errors for
-close, just ignoring the return value completely is the simplest fix.
----
- src/process/posix_spawn.c | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/src/process/posix_spawn.c b/src/process/posix_spawn.c
-index ae262f7..af12731 100644
---- a/src/process/posix_spawn.c
-+++ b/src/process/posix_spawn.c
-@@ -102,8 +102,7 @@ static int child(void *args_vp)
- }
- switch(op->cmd) {
- case FDOP_CLOSE:
-- if ((ret=__syscall(SYS_close, op->fd)))
-- goto fail;
-+ __syscall(SYS_close, op->fd);
- break;
- case FDOP_DUP2:
- if ((ret=__sys_dup2(op->srcfd, op->fd))<0)
---
-2.2.0
-
diff --git a/main/musl/0017-use-direct-syscall-rather-than-write-function-in-pos.patch b/main/musl/0017-use-direct-syscall-rather-than-write-function-in-pos.patch
deleted file mode 100644
index e7d39dd71..000000000
--- a/main/musl/0017-use-direct-syscall-rather-than-write-function-in-pos.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 8f7bc690f07e90177b176b6e19736ad7c1d49840 Mon Sep 17 00:00:00 2001
-From: Rich Felker <dalias@aerifal.cx>
-Date: Fri, 5 Dec 2014 21:19:39 -0500
-Subject: [PATCH] use direct syscall rather than write function in posix_spawn
- child
-
-the write function is a cancellation point and accesses thread-local
-state belonging to the calling thread in the parent process. since
-cancellation is blocked for the duration of posix_spawn, this is
-probably safe, but it's fragile and unnecessary. making the syscall
-directly is just as easy and clearly safe.
----
- src/process/posix_spawn.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/process/posix_spawn.c b/src/process/posix_spawn.c
-index af12731..0bdf71c 100644
---- a/src/process/posix_spawn.c
-+++ b/src/process/posix_spawn.c
-@@ -136,7 +136,7 @@ static int child(void *args_vp)
- fail:
- /* Since sizeof errno < PIPE_BUF, the write is atomic. */
- ret = -ret;
-- if (ret) while (write(p, &ret, sizeof ret) < 0);
-+ if (ret) while (__syscall(SYS_write, p, &ret, sizeof ret) < 0);
- _exit(127);
- }
-
---
-2.2.0
-
diff --git a/main/musl/0018-don-t-shadow-functions-with-macros-in-C.patch b/main/musl/0018-don-t-shadow-functions-with-macros-in-C.patch
deleted file mode 100644
index 1078ec32c..000000000
--- a/main/musl/0018-don-t-shadow-functions-with-macros-in-C.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-From f164875a84c35d0e0d132f99330d3fcda76ee7aa Mon Sep 17 00:00:00 2001
-From: Bobby Bingham <koorogi@koorogi.info>
-Date: Mon, 8 Dec 2014 20:18:12 -0600
-Subject: [PATCH] don't shadow functions with macros in C++
-
-C++ programmers typically expect something like "::function(x,y)" to work
-and may be surprised to find that "(::function)(x,y)" is actually required
-due to the headers declaring a macro version of some standard functions.
-
-We already omit function-like macros for C++ in most cases where there is
-a real function available. This commit extends this to the remaining
-function-like macros which have a real function version.
----
- include/complex.h | 2 ++
- include/pthread.h | 2 ++
- include/threads.h | 2 ++
- 3 files changed, 6 insertions(+)
-
-diff --git a/include/complex.h b/include/complex.h
-index 13a45c5..e1af0d5 100644
---- a/include/complex.h
-+++ b/include/complex.h
-@@ -101,6 +101,7 @@ double creal(double complex);
- float crealf(float complex);
- long double creall(long double complex);
-
-+#ifndef __cplusplus
- #define __CIMAG(x, t) \
- ((union { _Complex t __z; t __xy[2]; }){(_Complex t)(x)}.__xy[1])
-
-@@ -111,6 +112,7 @@ long double creall(long double complex);
- #define cimag(x) __CIMAG(x, double)
- #define cimagf(x) __CIMAG(x, float)
- #define cimagl(x) __CIMAG(x, long double)
-+#endif
-
- #define __CMPLX(x, y, t) \
- ((union { _Complex t __z; t __xy[2]; }){.__xy = {(x),(y)}}.__z)
-diff --git a/include/pthread.h b/include/pthread.h
-index f7c9568..2697e8b 100644
---- a/include/pthread.h
-+++ b/include/pthread.h
-@@ -84,7 +84,9 @@ __attribute__((const))
- pthread_t pthread_self(void);
-
- int pthread_equal(pthread_t, pthread_t);
-+#ifndef __cplusplus
- #define pthread_equal(x,y) ((x)==(y))
-+#endif
-
- int pthread_setcancelstate(int, int *);
- int pthread_setcanceltype(int, int *);
-diff --git a/include/threads.h b/include/threads.h
-index 0e5836c..0179482 100644
---- a/include/threads.h
-+++ b/include/threads.h
-@@ -51,7 +51,9 @@ void thrd_yield(void);
-
- thrd_t thrd_current(void);
- int thrd_equal(thrd_t, thrd_t);
-+#ifndef __cplusplus
- #define thrd_equal(A, B) ((A) == (B))
-+#endif
-
- void call_once(once_flag *, void (*)(void));
-
---
-2.2.0
-
diff --git a/main/musl/1001-add-basic-dns-record-parsing-functions.patch b/main/musl/1001-add-basic-dns-record-parsing-functions.patch
deleted file mode 100644
index 82d795ad0..000000000
--- a/main/musl/1001-add-basic-dns-record-parsing-functions.patch
+++ /dev/null
@@ -1,246 +0,0 @@
-From 2f267b57ef0e145e397be571a000a11dc8188af2 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
-Date: Mon, 14 Oct 2013 10:01:01 +0300
-Subject: [PATCH] add basic dns record parsing functions
-
----
- include/arpa/nameser.h | 24 ++++++-
- src/network/ns_parse.c | 172 +++++++++++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 195 insertions(+), 1 deletion(-)
- create mode 100644 src/network/ns_parse.c
-
-diff --git a/include/arpa/nameser.h b/include/arpa/nameser.h
-index b9ee665..9c5f990 100644
---- a/include/arpa/nameser.h
-+++ b/include/arpa/nameser.h
-@@ -1,6 +1,11 @@
- #ifndef _ARPA_NAMESER_H
- #define _ARPA_NAMESER_H
-
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
-+#include <sys/types.h>
- #include <stdint.h>
-
- #define __NAMESER 19991006
-@@ -48,6 +53,8 @@ extern const struct _ns_flagdata _ns_flagdata[];
- #define ns_msg_end(handle) ((handle)._eom + 0)
- #define ns_msg_size(handle) ((handle)._eom - (handle)._msg)
- #define ns_msg_count(handle, section) ((handle)._counts[section] + 0)
-+#define ns_msg_getflag(handle, flag) \
-+ (((handle)._flags & _ns_flagdata[flag].mask) >> _ns_flagdata[flag].shift)
-
- typedef struct __ns_rr {
- char name[NS_MAXDNAME];
-@@ -332,7 +339,18 @@ typedef enum __ns_cert_types {
- (cp) += NS_INT32SZ; \
- } while (0)
-
--
-+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
-+u_int ns_get16(const unsigned char *cp);
-+u_long ns_get32(const unsigned char *cp);
-+void ns_put16(u_int s, unsigned char *cp);
-+void ns_put32(u_long l, unsigned char *cp);
-+
-+int ns_initparse(const u_char *msg, int msglen, ns_msg *handle);
-+int ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr);
-+int ns_skiprr(const u_char *msg, const u_char *eom, ns_sect section, int count);
-+int ns_name_uncompress(const u_char *msg, const u_char *eom,
-+ const u_char *comp_dn, char *exp_dn, size_t length);
-+#endif
-
-
- #define __BIND 19950621
-@@ -464,4 +482,8 @@ typedef struct {
- #define PUTSHORT NS_PUT16
- #define PUTLONG NS_PUT32
-
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif
-diff --git a/src/network/ns_parse.c b/src/network/ns_parse.c
-new file mode 100644
-index 0000000..7e40237
---- /dev/null
-+++ b/src/network/ns_parse.c
-@@ -0,0 +1,172 @@
-+#define _BSD_SOURCE
-+#include <errno.h>
-+#include <stddef.h>
-+#include <resolv.h>
-+#include <arpa/nameser.h>
-+
-+const struct _ns_flagdata _ns_flagdata[16] = {
-+ { 0x8000, 15 },
-+ { 0x7800, 11 },
-+ { 0x0400, 10 },
-+ { 0x0200, 9 },
-+ { 0x0100, 8 },
-+ { 0x0080, 7 },
-+ { 0x0040, 6 },
-+ { 0x0020, 5 },
-+ { 0x0010, 4 },
-+ { 0x000f, 0 },
-+ { 0x0000, 0 },
-+ { 0x0000, 0 },
-+ { 0x0000, 0 },
-+ { 0x0000, 0 },
-+ { 0x0000, 0 },
-+ { 0x0000, 0 },
-+};
-+
-+u_int ns_get16(const unsigned char *cp)
-+{
-+ u_short s;
-+ NS_GET16(s, cp);
-+ return s;
-+}
-+
-+u_long ns_get32(const unsigned char *cp)
-+{
-+ u_long l;
-+ NS_GET32(l, cp);
-+ return l;
-+}
-+
-+void ns_put16(u_int s, unsigned char *cp)
-+{
-+ NS_PUT16(s, cp);
-+}
-+
-+void ns_put32(u_long l, unsigned char *cp)
-+{
-+ NS_PUT32(l, cp);
-+}
-+
-+int ns_initparse(const unsigned char *msg, int msglen, ns_msg *handle)
-+{
-+ int i, r;
-+
-+ handle->_msg = msg;
-+ handle->_eom = msg + msglen;
-+ if (msglen < (2 + ns_s_max) * NS_INT16SZ) goto bad;
-+ NS_GET16(handle->_id, msg);
-+ NS_GET16(handle->_flags, msg);
-+ for (i = 0; i < ns_s_max; i++) NS_GET16(handle->_counts[i], msg);
-+ for (i = 0; i < ns_s_max; i++) {
-+ if (handle->_counts[i]) {
-+ handle->_sections[i] = msg;
-+ r = ns_skiprr(msg, handle->_eom, i, handle->_counts[i]);
-+ if (r < 0) return -1;
-+ msg += r;
-+ } else {
-+ handle->_sections[i] = NULL;
-+ }
-+ }
-+ if (msg != handle->_eom) goto bad;
-+ handle->_sect = ns_s_max;
-+ handle->_rrnum = -1;
-+ handle->_msg_ptr = NULL;
-+ return 0;
-+bad:
-+ errno = EMSGSIZE;
-+ return -1;
-+}
-+
-+int ns_skiprr(const u_char *ptr, const u_char *eom, ns_sect section, int count)
-+{
-+ const u_char *p = ptr;
-+ int r;
-+
-+ while (count--) {
-+ r = dn_skipname(p, eom);
-+ if (r < 0) goto bad;
-+ p += r + 2 * NS_INT16SZ;
-+ if (section != ns_s_qd) {
-+ if (p + NS_INT32SZ + NS_INT16SZ > eom) goto bad;
-+ p += NS_INT32SZ;
-+ NS_GET16(r, p);
-+ p += r;
-+ }
-+ }
-+ if (p > eom) goto bad;
-+ return ptr - p;
-+bad:
-+ errno = EMSGSIZE;
-+ return -1;
-+}
-+
-+int ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr)
-+{
-+ int r;
-+
-+ if (section < 0 || section >= ns_s_max) goto bad;
-+ if (section != handle->_sect) {
-+ handle->_sect = section;
-+ handle->_rrnum = 0;
-+ handle->_msg_ptr = handle->_sections[section];
-+ }
-+ if (rrnum == -1) rrnum = handle->_rrnum;
-+ if (rrnum < 0 || rrnum >= handle->_counts[section]) goto bad;
-+ if (rrnum < handle->_rrnum) {
-+ handle->_rrnum = 0;
-+ handle->_msg_ptr = handle->_sections[section];
-+ }
-+ if (rrnum > handle->_rrnum) {
-+ r = ns_skiprr(handle->_msg_ptr, handle->_eom, section, rrnum - handle->_rrnum);
-+ if (r < 0) return -1;
-+ handle->_msg_ptr += r;
-+ handle->_rrnum = rrnum;
-+ }
-+ r = dn_expand(handle->_msg, handle->_eom, handle->_msg_ptr, rr->name, NS_MAXDNAME);
-+ if (r < 0) return -1;
-+ handle->_msg_ptr += r;
-+ if (handle->_msg_ptr + 2 * NS_INT16SZ > handle->_eom) goto size;
-+ NS_GET16(rr->type, handle->_msg_ptr);
-+ NS_GET16(rr->rr_class, handle->_msg_ptr);
-+ if (section != ns_s_qd) {
-+ if (handle->_msg_ptr + NS_INT32SZ + NS_INT16SZ > handle->_eom) goto size;
-+ NS_GET32(rr->ttl, handle->_msg_ptr);
-+ NS_GET16(rr->rdlength, handle->_msg_ptr);
-+ if (handle->_msg_ptr + rr->rdlength > handle->_eom) goto size;
-+ rr->rdata = handle->_msg_ptr;
-+ handle->_msg_ptr += rr->rdlength;
-+ } else {
-+ rr->ttl = 0;
-+ rr->rdlength = 0;
-+ rr->rdata = NULL;
-+ }
-+ handle->_rrnum++;
-+ if (handle->_rrnum > handle->_counts[section]) {
-+ handle->_sect = section + 1;
-+ if (handle->_sect == ns_s_max) {
-+ handle->_rrnum = -1;
-+ handle->_msg_ptr = NULL;
-+ } else {
-+ handle->_rrnum = 0;
-+ }
-+ }
-+ return 0;
-+bad:
-+ errno = ENODEV;
-+ return -1;
-+size:
-+ errno = EMSGSIZE;
-+ return -1;
-+}
-+
-+int __dn_expand(const unsigned char *, const unsigned char *, const unsigned char *, char *, int);
-+
-+int ns_name_uncompress(const u_char *msg, const u_char *eom,
-+ const u_char *src, char *dst, size_t dstsiz)
-+{
-+ int r;
-+ r = __dn_expand(msg, eom, src, dst, dstsiz);
-+ if (r < 0) errno = EMSGSIZE;
-+ return r;
-+}
-+
---
-2.0.2
-
diff --git a/main/musl/1002-implement-FNM_CASEFOLD-gnu-extension.patch b/main/musl/1002-implement-FNM_CASEFOLD-gnu-extension.patch
deleted file mode 100644
index 21a4308b5..000000000
--- a/main/musl/1002-implement-FNM_CASEFOLD-gnu-extension.patch
+++ /dev/null
@@ -1,114 +0,0 @@
-From bfc8d9df41d16bb8beb3625286576c44f10cb898 Mon Sep 17 00:00:00 2001
-From: Nagy Szabolcs <nsz@port70.net>
-Date: Fri, 10 Oct 2014 12:09:03 +0200
-Subject: [PATCH] implement FNM_CASEFOLD gnu extension
-
----
- src/regex/fnmatch.c | 36 +++++++++++++++++++++++++-----------
- 1 file changed, 25 insertions(+), 11 deletions(-)
-
-diff --git a/src/regex/fnmatch.c b/src/regex/fnmatch.c
-index 4df10a3..7f6b65f 100644
---- a/src/regex/fnmatch.c
-+++ b/src/regex/fnmatch.c
-@@ -97,7 +97,13 @@ escaped:
- return pat[0];
- }
-
--static int match_bracket(const char *p, int k)
-+static int casefold(int k)
-+{
-+ int c = towupper(k);
-+ return c == k ? towlower(k) : c;
-+}
-+
-+static int match_bracket(const char *p, int k, int kfold)
- {
- wchar_t wc;
- int inv = 0;
-@@ -119,7 +125,10 @@ static int match_bracket(const char *p, int k)
- wchar_t wc2;
- int l = mbtowc(&wc2, p+1, 4);
- if (l < 0) return 0;
-- if (wc<=wc2 && (unsigned)k-wc <= wc2-wc) return !inv;
-+ if (wc <= wc2)
-+ if ((unsigned)k-wc <= wc2-wc ||
-+ (unsigned)kfold-wc <= wc2-wc)
-+ return !inv;
- p += l-1;
- continue;
- }
-@@ -132,7 +141,9 @@ static int match_bracket(const char *p, int k)
- char buf[16];
- memcpy(buf, p0, p-1-p0);
- buf[p-1-p0] = 0;
-- if (iswctype(k, wctype(buf))) return !inv;
-+ if (iswctype(k, wctype(buf)) ||
-+ iswctype(kfold, wctype(buf)))
-+ return !inv;
- }
- continue;
- }
-@@ -143,7 +154,7 @@ static int match_bracket(const char *p, int k)
- if (l < 0) return 0;
- p += l-1;
- }
-- if (wc==k) return !inv;
-+ if (wc==k || wc==kfold) return !inv;
- }
- return inv;
- }
-@@ -153,7 +164,7 @@ static int fnmatch_internal(const char *pat, size_t m, const char *str, size_t n
- const char *p, *ptail, *endpat;
- const char *s, *stail, *endstr;
- size_t pinc, sinc, tailcnt=0;
-- int c, k;
-+ int c, k, kfold;
-
- if (flags & FNM_PERIOD) {
- if (*str == '.' && *pat != '.')
-@@ -173,10 +184,11 @@ static int fnmatch_internal(const char *pat, size_t m, const char *str, size_t n
- return (c==END) ? 0 : FNM_NOMATCH;
- str += sinc;
- n -= sinc;
-+ kfold = flags & FNM_CASEFOLD ? casefold(k) : k;
- if (c == BRACKET) {
-- if (!match_bracket(pat, k))
-+ if (!match_bracket(pat, k, kfold))
- return FNM_NOMATCH;
-- } else if (c != QUESTION && k != c) {
-+ } else if (c != QUESTION && k != c && kfold != c) {
- return FNM_NOMATCH;
- }
- pat+=pinc;
-@@ -233,10 +245,11 @@ static int fnmatch_internal(const char *pat, size_t m, const char *str, size_t n
- break;
- }
- s += sinc;
-+ kfold = flags & FNM_CASEFOLD ? casefold(k) : k;
- if (c == BRACKET) {
-- if (!match_bracket(p-pinc, k))
-+ if (!match_bracket(p-pinc, k, kfold))
- return FNM_NOMATCH;
-- } else if (c != QUESTION && k != c) {
-+ } else if (c != QUESTION && k != c && kfold != c) {
- return FNM_NOMATCH;
- }
- }
-@@ -261,10 +274,11 @@ static int fnmatch_internal(const char *pat, size_t m, const char *str, size_t n
- k = str_next(s, endstr-s, &sinc);
- if (!k)
- return FNM_NOMATCH;
-+ kfold = flags & FNM_CASEFOLD ? casefold(k) : k;
- if (c == BRACKET) {
-- if (!match_bracket(p-pinc, k))
-+ if (!match_bracket(p-pinc, k, kfold))
- break;
-- } else if (c != QUESTION && k != c) {
-+ } else if (c != QUESTION && k != c && kfold != c) {
- break;
- }
- s += sinc;
---
-2.1.0
-
diff --git a/main/musl/1003-remove-ulimit-fiddling-from-setxid.patch b/main/musl/1003-remove-ulimit-fiddling-from-setxid.patch
deleted file mode 100644
index e66cdc3b7..000000000
--- a/main/musl/1003-remove-ulimit-fiddling-from-setxid.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 1a2526fae0f3747ff7f60e60aa16b8148fd8ea07 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
-Date: Thu, 24 Jul 2014 09:19:46 +0300
-Subject: [PATCH] remove ulimit fiddling from setxid
-
-It was only needed to workaround bugs in linux 3.1 and earlier.
-Incidentally, the ulimit fiddling introduced another bug: it would
-fail for non-root users.
-
-Additionally, this fixes updating c->err with atomic cas.
----
- src/unistd/setxid.c | 25 +++++++------------------
- 1 file changed, 7 insertions(+), 18 deletions(-)
-
-diff --git a/src/unistd/setxid.c b/src/unistd/setxid.c
-index 2f651a1..6fcbc61 100644
---- a/src/unistd/setxid.c
-+++ b/src/unistd/setxid.c
-@@ -1,7 +1,7 @@
- #include <unistd.h>
- #include <errno.h>
--#include <sys/resource.h>
- #include "syscall.h"
-+#include "atomic.h"
- #include "libc.h"
-
- struct ctx {
-@@ -9,35 +9,24 @@ struct ctx {
- int nr, rlim, err;
- };
-
--/* We jump through hoops to eliminate the possibility of partial failures. */
-+/* This is not reliable on kernels earlier than 3.1, as set*uid can
-+ * fail with EAGAIN if ulimit is exceeded. If that happens, the process
-+ * is left in inconsistent state. */
-
- int __setrlimit(int, const struct rlimit *);
-
- static void do_setxid(void *p)
- {
- struct ctx *c = p;
-+ int r;
- if (c->err) return;
-- if (c->rlim && c->id >= 0 && c->id != getuid()) {
-- struct rlimit inf = { RLIM_INFINITY, RLIM_INFINITY }, old;
-- getrlimit(RLIMIT_NPROC, &old);
-- if ((c->err = -__setrlimit(RLIMIT_NPROC, &inf)) && libc.threads_minus_1)
-- return;
-- c->err = -__syscall(c->nr, c->id, c->eid, c->sid);
-- __setrlimit(RLIMIT_NPROC, &old);
-- return;
-- }
-- c->err = -__syscall(c->nr, c->id, c->eid, c->sid);
-+ r = __syscall(c->nr, c->id, c->eid, c->sid);
-+ if (r) a_cas(&c->err, 0, -r);
- }
-
- int __setxid(int nr, int id, int eid, int sid)
- {
- struct ctx c = { .nr = nr, .id = id, .eid = eid, .sid = sid };
-- switch (nr) {
-- case SYS_setuid:
-- case SYS_setreuid:
-- case SYS_setresuid:
-- c.rlim = 1;
-- }
- __synccall(do_setxid, &c);
- if (c.err) {
- errno = c.err;
---
-2.0.2
-
diff --git a/main/musl/APKBUILD b/main/musl/APKBUILD
index d1001181e..3024e68b0 100644
--- a/main/musl/APKBUILD
+++ b/main/musl/APKBUILD
@@ -1,8 +1,8 @@
# Contributor: William Pitcock <nenolod@dereferenced.org>
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=musl
-pkgver=1.1.5
-pkgrel=4
+pkgver=1.1.6
+pkgrel=0
pkgdesc="the musl c library (libc) implementation"
url="http://www.musl-libc.org/"
arch="all"
@@ -13,30 +13,8 @@ makedepends="$depends_dev"
install="$pkgname.post-upgrade"
subpackages="$pkgname-dev $pkgname-utils $pkgname-dbg"
source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz
- 0001-manually-shrink-wrap-fast-path-in-pthread_once.patch
- 0002-fix-failure-of-open-to-read-variadic-mode-argument-f.patch
- 0003-fix-invalid-access-by-openat-to-possibly-missing-var.patch
- 0004-fix-uninitialized-mode-variable-in-openat-function.patch
- 0005-math-fix-x86_64-and-x32-asm-not-to-use-sahf-instruct.patch
- 0006-math-use-fnstsw-consistently-instead-of-fstsw-in-x87.patch
- 0007-fix-behavior-of-printf-with-alt-form-octal-zero-prec.patch
- 0008-implement-a-private-state-for-the-uchar.h-functions.patch
- 0009-getopt-fix-optional-argument-processing.patch
- 0010-adapt-dynamic-linker-for-new-binutils-versions-that-.patch
- 0011-add-support-for-non-option-arguments-extension-to-ge.patch
- 0012-fix-uninitialized-output-from-sched_getaffinity.patch
- 0013-fix-return-value-of-pthread_getaffinity_np-and-pthre.patch
- 0014-add-arm-private-syscall-numbers.patch
- 0015-fix-getopt-handling-of-modifier-for-multibyte-option.patch
- 0016-don-t-fail-posix_spawn-on-failed-close.patch
- 0017-use-direct-syscall-rather-than-write-function-in-pos.patch
- 0018-don-t-shadow-functions-with-macros-in-C.patch
- 1001-add-basic-dns-record-parsing-functions.patch
- 1002-implement-FNM_CASEFOLD-gnu-extension.patch
- 1003-remove-ulimit-fiddling-from-setxid.patch
ldconfig
- getopt_long.c
__stack_chk_fail_local.c
getconf.c
getent.c
@@ -52,10 +30,6 @@ prepare() {
*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
esac
done
-
- # use GNU compatible getopt() from BSD
- rm -f src/misc/getopt*.c
- cp "$srcdir"/getopt_long.c src/misc/
}
install_sysroot_headers() {
@@ -136,86 +110,20 @@ utils() {
install -D -m755 "$srcdir"/ldconfig "$subpkgdir"/sbin
}
-md5sums="94f8aa9dab80229fed68991bb9984cc5 musl-1.1.5.tar.gz
-facc7c96b21a72bc3ef3917f4add88ca 0001-manually-shrink-wrap-fast-path-in-pthread_once.patch
-4ef3fa8b6fdc78515b83b7680b55a55f 0002-fix-failure-of-open-to-read-variadic-mode-argument-f.patch
-70f9b257bcc76d6d9fa1e4d55327c220 0003-fix-invalid-access-by-openat-to-possibly-missing-var.patch
-7d1b8c611caafaf3b6c77359c7bf521e 0004-fix-uninitialized-mode-variable-in-openat-function.patch
-bdd96730e9f4ce664502bc31336f4941 0005-math-fix-x86_64-and-x32-asm-not-to-use-sahf-instruct.patch
-feba13393b07c4ce0a87cba7e3de49e1 0006-math-use-fnstsw-consistently-instead-of-fstsw-in-x87.patch
-859ca10150b56fb1ec046c75554c8aed 0007-fix-behavior-of-printf-with-alt-form-octal-zero-prec.patch
-d7cc03dbd77755b25c7108aada242980 0008-implement-a-private-state-for-the-uchar.h-functions.patch
-5ff1064dd67d75814b08270d1448042e 0009-getopt-fix-optional-argument-processing.patch
-518c3b3a9819bf7ce1743a3fe58b970e 0010-adapt-dynamic-linker-for-new-binutils-versions-that-.patch
-3896f988be70fad4ff9a774580b23e6c 0011-add-support-for-non-option-arguments-extension-to-ge.patch
-d9b4d921348fa86e57c44bf4c95714bd 0012-fix-uninitialized-output-from-sched_getaffinity.patch
-4ac6a08107b65927400f59f8f5e07f15 0013-fix-return-value-of-pthread_getaffinity_np-and-pthre.patch
-5d8dde8258654d404d0b7a06c5046829 0014-add-arm-private-syscall-numbers.patch
-256165e3059e1b2ed76397d53870eb5d 0015-fix-getopt-handling-of-modifier-for-multibyte-option.patch
-346d4db3e125b0679a4e5fedcbd99644 0016-don-t-fail-posix_spawn-on-failed-close.patch
-b3e9f774ca938dcd1833dbe4af44fea8 0017-use-direct-syscall-rather-than-write-function-in-pos.patch
-c59cc913f8ce2daffe4ceecc136ff81d 0018-don-t-shadow-functions-with-macros-in-C.patch
-2371eb1ce057fcb709a0e6a81f0d356c 1001-add-basic-dns-record-parsing-functions.patch
-c4c2f5b48af0aef958d191659b9e5192 1002-implement-FNM_CASEFOLD-gnu-extension.patch
-71b2a4dcc39c436a6b89173943424043 1003-remove-ulimit-fiddling-from-setxid.patch
+md5sums="591e2d25a12ca1748e30ee0cf23f8b8a musl-1.1.6.tar.gz
830d01f7821b978df770b06db3790921 ldconfig
-61c6c1e84ed1df82abbe6d75e90cf21c getopt_long.c
0df687757221bbb0fc1aa67f1bd646f9 __stack_chk_fail_local.c
57ef2c63b9ec6a2041694ace97d4ffa2 getconf.c
2b941c4251cac44988a4abfc50e21267 getent.c
45f92f8d59cf84d765de698a9578dbf4 iconv.c"
-sha256sums="352362b1724cc9740f4c3ce0fe02aae45e4de9809ea4ac961f31aedc11b87393 musl-1.1.5.tar.gz
-dec352852801f8a5c7e6957014f761efce21e4b6c3223cf8ee6f7cac24c12c01 0001-manually-shrink-wrap-fast-path-in-pthread_once.patch
-83168c779dbc575ab240aa360c320bdca8de41cbbd0ad8b9a26fbd74466ca58d 0002-fix-failure-of-open-to-read-variadic-mode-argument-f.patch
-c04a1272b934d968a1fbec30269d02171ae5d6b7d4f3cd5d49cbd905c975341c 0003-fix-invalid-access-by-openat-to-possibly-missing-var.patch
-7d16772140a3f0811c0cf6822eb713e7a77b8974b609f9c7634ae42c3ca25a95 0004-fix-uninitialized-mode-variable-in-openat-function.patch
-6052e3b1e0f489edcba648a78122ec21f0e2e2085917b1d2544e5802b2c83e0d 0005-math-fix-x86_64-and-x32-asm-not-to-use-sahf-instruct.patch
-44905edc8b8c66b94c3428f029cd6aa5147074a02ca7f795bc8f92866ba328cf 0006-math-use-fnstsw-consistently-instead-of-fstsw-in-x87.patch
-46306557a669ac4e78a44664b49374a4a30eb041bba5f988bc666f29a2bba3d6 0007-fix-behavior-of-printf-with-alt-form-octal-zero-prec.patch
-a3ac50a13d60ed7115fa423030029513d0f5889b63b7047356234e05095d306c 0008-implement-a-private-state-for-the-uchar.h-functions.patch
-9300e0b2c7095fb070a43097c79aad34f019015dfcfae32ef946411537471d2f 0009-getopt-fix-optional-argument-processing.patch
-bb48d16025f1a8323673141a0d6e5b5e54ddfbf7056cf8e2e38343e55a85a67e 0010-adapt-dynamic-linker-for-new-binutils-versions-that-.patch
-44801a22c3cabc457043073a707412396c97fef0d0f49984818ee8df69f1b3d3 0011-add-support-for-non-option-arguments-extension-to-ge.patch
-e3622c3b84c0f984b864ecdf5d26f602723d81afee0c9c5dd5a2f0f1b6325965 0012-fix-uninitialized-output-from-sched_getaffinity.patch
-a6fa226f2bc0b2f56ef38df09bfe066b70e00d915b99657c2ced29c1262dfce4 0013-fix-return-value-of-pthread_getaffinity_np-and-pthre.patch
-fa2306adeda1a2ee733fcbc64fc8e0bb377b3c0dd6870ea15322722f08d135e1 0014-add-arm-private-syscall-numbers.patch
-8c3ca04de81c487c7c8a237adeae3800adcc00996a2535fbdccd3d683be30abf 0015-fix-getopt-handling-of-modifier-for-multibyte-option.patch
-598856ea334962a36b3ff99d1909306deb7dfe235b0ab8c5e20e531027fe4cf4 0016-don-t-fail-posix_spawn-on-failed-close.patch
-0f7a2a055c87c2a2616b106fcf5d9f35c8a710c12383e652744f7429e0bfae96 0017-use-direct-syscall-rather-than-write-function-in-pos.patch
-da4d97570b552e332859f66c1a6fe8f4dee66b809e1e9f39fb1a3fc5a6e3574d 0018-don-t-shadow-functions-with-macros-in-C.patch
-75053a31f6b84a64846d92c0ec631c76d7f747a9c0dc92a6dc1aa1bddfe2ea76 1001-add-basic-dns-record-parsing-functions.patch
-57cb534a603dce32efa48be04ce7b1ca3f287fd8cc72258589fd529e86c1dd47 1002-implement-FNM_CASEFOLD-gnu-extension.patch
-fb542c2bd5081ff2f601c519edb3dac8f54ca5c888f44bc6cfb84e6565472025 1003-remove-ulimit-fiddling-from-setxid.patch
+sha256sums="5a0160c55c540d5b90158617a57647f1b03209f58d9ee70dbce19d1115b4f1b4 musl-1.1.6.tar.gz
b4a2c06db38742e8c42c3c9838b285a7d8cdac6c091ff3df5ff9a15f1e41b9c7 ldconfig
-d9b644ec20bc33e81a7c52b9fcf7973d835923a69faf50f03db45534b811bd96 getopt_long.c
299a7d75a09de3e2e11e7fb4acc3182e4a14e868093d2f30938fce9bfcff13da __stack_chk_fail_local.c
d87d0cbb3690ae2c5d8cc218349fd8278b93855dd625deaf7ae50e320aad247c getconf.c
68373a55e89ce85c562d941ccf588337d6cc6c9c17689d695f65cd7607134bbe getent.c
f79a2930a2e5bb0624321589edf8b889d1e9b603e01e6b7ae214616605b3fdd7 iconv.c"
-sha512sums="4436887367137cbfc6d34e0f403b8dd36db2a55a5160681fef4de7cc0cb1be38487ea708e6aa6dc1328b61c62868b6cc19f099649c9d12e1ba812dfa8844b772 musl-1.1.5.tar.gz
-665cdf9e616493629759ee8184863c124bd042c343f9408e93c5e87d9ed63ded1dce875cd659270d6bcb4453833ec578c81636c80aac15b6bb98f73295087e62 0001-manually-shrink-wrap-fast-path-in-pthread_once.patch
-e650cf51c88204fad1dc29f8df8ec2faa5f746fa7b818e8b695ed8bb5c3788e7144e342e793731e0ebeaa7bc836b6b0d0f8006e33b802b96450f6cdc9bbdb0cc 0002-fix-failure-of-open-to-read-variadic-mode-argument-f.patch
-96d884faff0b54e1cca9673faa26041c600148e86069ca029fa08fcba25423adc81ada03a3039000f6dfaa3f57f97197b2b54d231b08a051a61ce992e4aaa796 0003-fix-invalid-access-by-openat-to-possibly-missing-var.patch
-15ba4fa68e8d7b890672789b03f7772bb150b1143883b2e77ade3b7d19ecf9ce2220b34a9ab00bd58e255880ee4cd79278986683ca5af32f84df3c3d09a79c58 0004-fix-uninitialized-mode-variable-in-openat-function.patch
-ab26de82db2cb9d36bc8f21e5d1a9e89b8e55f189ec67e87d036911ed4bed6e22a78c06ca676136d9c3903f3702f517785566b3aec67d3cb8f861676dc795283 0005-math-fix-x86_64-and-x32-asm-not-to-use-sahf-instruct.patch
-79a082aa9a8588a1778f6d447cd938db7c8c0564fbded6dfd795a96d2c8cc1080b9553cf3a68d951a349c7eae40fd854cdf241a2633afbd456f61d077a9c0f43 0006-math-use-fnstsw-consistently-instead-of-fstsw-in-x87.patch
-564c590cc88eaf85a9c2d65c179589acfd6590639d51227375e46ebe0aa95421ac21c9042aae729a07e6ff8373a81e5c2f1e1776a76372d6a051b23f2e44df69 0007-fix-behavior-of-printf-with-alt-form-octal-zero-prec.patch
-c4fa58663099b5a322557e7f59bdfbe13082baaa07fd387e62a0a72ed89b41b10d766d9e5c7fac8c1d56dc85c1528c7155bfa9e72bd29fe989ff88d56e8b6184 0008-implement-a-private-state-for-the-uchar.h-functions.patch
-c8e8d9234993756822036e6854a5a9b80319a3c568f0ffb61efc7d5e963d008e0eb4b581535a257280759bedbba131d4cd9772dea6e8b1fa8edb41a4c08cd985 0009-getopt-fix-optional-argument-processing.patch
-542173281f5c424922157833aa142bec567d99e402299f59a63685cef31434a5f19fbe55d6858250fc4d930a755855c0cc6946074869cf58777c551ceff4b9a9 0010-adapt-dynamic-linker-for-new-binutils-versions-that-.patch
-c15f3a2cbc7e83efbad86930d64e3dd131a4ecc0c0956a395d344ef7e6d2e60d70b2181aefe7c2dddb866cb854d5d77d211ded6344784ddc789409dc1572c5d9 0011-add-support-for-non-option-arguments-extension-to-ge.patch
-fcd04e66c812d108712d2ad937f117500d73311a0d1390bd6834d2093d844751bb0644f8b4ea820a3430b7b73e318a84e58f26419d5e664fb56b4507f5cf8e9c 0012-fix-uninitialized-output-from-sched_getaffinity.patch
-85c3082a4fde1ec2739eb78b820792430cba9aeb082c53718698681b929675ee73546968cc3a41b38711afa2d140296bee7d9e7f43e9d5279cc7fd508835b1fc 0013-fix-return-value-of-pthread_getaffinity_np-and-pthre.patch
-3374b983f6a5e4f8f0dc3e67c0cfb0d6fac153c6d5f7e604381e898b318f183faf8fc3995b960cd5a5fd7df0127b16cc6a98e3b0a534b1f156412af492f90ba1 0014-add-arm-private-syscall-numbers.patch
-9a7a8a5acb59f45d9fd950d508419ccf10213d954659f454de2fe0542be132497cf19605bb59ed641c171d27053c22789b4d6012b6574721587358e7b6efdad1 0015-fix-getopt-handling-of-modifier-for-multibyte-option.patch
-54a747fb14b38ffdd0abcd6b202a01e3e778cf853152a4554f7941a2e2544ab1c4c498e2646f421b421180e934ff0ff3372bbd8e08b59b800378cfb2db179940 0016-don-t-fail-posix_spawn-on-failed-close.patch
-59060226956ddef64ade61b98a46a6faa5896061186abfa5a8adf1786584beff79acfa6197e2dc7ee1104ad300eda979ad18b6d5466a5dc98ae8957576a5b09d 0017-use-direct-syscall-rather-than-write-function-in-pos.patch
-a627055d150087fae4d484c60ac7be8cccae0c1b8ddb88684d7b03255c72c1306dc55b7a1ee08ef691691a6b79bfd335609ea5271363c9f4824e48043dd5b037 0018-don-t-shadow-functions-with-macros-in-C.patch
-5b8ffa0a50419581adbf6ce2dae5797774022551c6331fa5aa2ff13635eb72b74eedd8a92cb478d45d73e1956af2f588669681ac414f3a255abd4d8ba8579448 1001-add-basic-dns-record-parsing-functions.patch
-f379f2308a8ed04560d08db90935acf56617d1b650f6227212e9ad530b53318aaecfea326ad4727439112b602a810db6857d1fe72d6e3ddeec519c99cd3608d2 1002-implement-FNM_CASEFOLD-gnu-extension.patch
-dae010b45419fcab64410568466f659cdc874e63113025e2cbc2fbab047b470fec23851ecbef08886505924482a069caf37c16b483b6922535fbd31832f1c4a3 1003-remove-ulimit-fiddling-from-setxid.patch
+sha512sums="7ae7901e040990937c9473f98c7921736aa9ba051bf133b0a089c0730949ef83acca396333a5afa08edc2514081ab9f36c14aed343919b0d92e0e574737c8bab musl-1.1.6.tar.gz
8d3a2d5315fc56fee7da9abb8b89bb38c6046c33d154c10d168fb35bfde6b0cf9f13042a3bceee34daf091bc409d699223735dcf19f382eeee1f6be34154f26f ldconfig
-140f3f20d30bd95ebce8c41b8cc7f616c6cbedf4ea06c729c21014e74f6043796825cc40ebc5180620ea38173afdba23f09ebf6d8b11fa05440b14d23764fca9 getopt_long.c
062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c
0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d getconf.c
b35de9847353b273516162ed4828a810c6130fc5b7de44ee4433003b3f99647b25792d9b1c40dfc67069add11f3fb850e5c35d4f1912dccac108059bbbdfd5a2 getent.c
diff --git a/main/musl/getopt_long.c b/main/musl/getopt_long.c
deleted file mode 100644
index 65e19940d..000000000
--- a/main/musl/getopt_long.c
+++ /dev/null
@@ -1,618 +0,0 @@
-/*
- * Copyright (c) 2002 Todd C. Miller <Todd.Miller@courtesan.com>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Sponsored in part by the Defense Advanced Research Projects
- * Agency (DARPA) and Air Force Research Laboratory, Air Force
- * Materiel Command, USAF, under agreement number F39502-99-1-0512.
- */
-/*-
- * Copyright (c) 2000 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Dieter Baron and Thomas Klausner.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define _GNU_SOURCE
-#include <errno.h>
-#include <stdio.h>
-#include <getopt.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define GNU_COMPATIBLE /* Be more compatible, configure's use us! */
-
-int opterr = 1; /* if error message should be printed */
-int optind = 1; /* index into parent argv vector */
-int optopt = '?'; /* character checked for validity */
-int optreset; /* reset getopt */
-char *optarg; /* argument associated with option */
-
-#define PRINT_ERROR ((opterr) && (*options != ':'))
-
-#define FLAG_PERMUTE 0x01 /* permute non-options to the end of argv */
-#define FLAG_ALLARGS 0x02 /* treat non-options as args to option "-1" */
-#define FLAG_LONGONLY 0x04 /* operate as getopt_long_only */
-
-/* return values */
-#define BADCH (int)'?'
-#define BADARG ((*options == ':') ? (int)':' : (int)'?')
-#define INORDER (int)1
-
-#define EMSG ""
-
-#ifdef GNU_COMPATIBLE
-#define NO_PREFIX (-1)
-#define D_PREFIX 0
-#define DD_PREFIX 1
-#define W_PREFIX 2
-#endif
-
-static int getopt_internal(int, char * const *, const char *,
- const struct option *, int *, int);
-static int parse_long_options(char * const *, const char *,
- const struct option *, int *, int, int);
-static int gcd(int, int);
-static void permute_args(int, int, int, char * const *);
-
-static char *place = EMSG; /* option letter processing */
-
-/* XXX: set optreset to 1 rather than these two */
-static int nonopt_start = -1; /* first non option argument (for permute) */
-static int nonopt_end = -1; /* first option after non options (for permute) */
-
-/* Error messages */
-static const char recargchar[] = "option requires an argument -- %c\n";
-static const char illoptchar[] = "illegal option -- %c\n"; /* From P1003.2 */
-#ifdef GNU_COMPATIBLE
-static int dash_prefix = NO_PREFIX;
-static const char gnuoptchar[] = "invalid option -- %c\n";
-
-static const char recargstring[] = "option `%s%s' requires an argument\n";
-static const char ambig[] = "option `%s%.*s' is ambiguous\n";
-static const char noarg[] = "option `%s%.*s' doesn't allow an argument\n";
-static const char illoptstring[] = "unrecognized option `%s%s'\n";
-#else
-static const char recargstring[] = "option requires an argument -- %s\n";
-static const char ambig[] = "ambiguous option -- %.*s\n";
-static const char noarg[] = "option doesn't take an argument -- %.*s\n";
-static const char illoptstring[] = "unknown option -- %s\n";
-#endif
-
-/*
- * Compute the greatest common divisor of a and b.
- */
-static int
-gcd(int a, int b)
-{
- int c;
-
- c = a % b;
- while (c != 0) {
- a = b;
- b = c;
- c = a % b;
- }
-
- return (b);
-}
-
-/*
- * Exchange the block from nonopt_start to nonopt_end with the block
- * from nonopt_end to opt_end (keeping the same order of arguments
- * in each block).
- */
-static void
-permute_args(int panonopt_start, int panonopt_end, int opt_end,
- char * const *nargv)
-{
- int cstart, cyclelen, i, j, ncycle, nnonopts, nopts, pos;
- char *swap;
-
- /*
- * compute lengths of blocks and number and size of cycles
- */
- nnonopts = panonopt_end - panonopt_start;
- nopts = opt_end - panonopt_end;
- ncycle = gcd(nnonopts, nopts);
- cyclelen = (opt_end - panonopt_start) / ncycle;
-
- for (i = 0; i < ncycle; i++) {
- cstart = panonopt_end+i;
- pos = cstart;
- for (j = 0; j < cyclelen; j++) {
- if (pos >= panonopt_end)
- pos -= nnonopts;
- else
- pos += nopts;
- swap = nargv[pos];
- /* LINTED const cast */
- ((char **) nargv)[pos] = nargv[cstart];
- /* LINTED const cast */
- ((char **)nargv)[cstart] = swap;
- }
- }
-}
-
-/*
- * parse_long_options --
- * Parse long options in argc/argv argument vector.
- * Returns -1 if short_too is set and the option does not match long_options.
- */
-static int
-parse_long_options(char * const *nargv, const char *options,
- const struct option *long_options, int *idx, int short_too, int flags)
-{
- char *current_argv, *has_equal;
-#ifdef GNU_COMPATIBLE
- char *current_dash;
-#endif
- size_t current_argv_len;
- int i, match, exact_match, second_partial_match;
-
- current_argv = place;
-#ifdef GNU_COMPATIBLE
- switch (dash_prefix) {
- case D_PREFIX:
- current_dash = "-";
- break;
- case DD_PREFIX:
- current_dash = "--";
- break;
- case W_PREFIX:
- current_dash = "-W ";
- break;
- default:
- current_dash = "";
- break;
- }
-#endif
- match = -1;
- exact_match = 0;
- second_partial_match = 0;
-
- optind++;
-
- if ((has_equal = strchr(current_argv, '=')) != NULL) {
- /* argument found (--option=arg) */
- current_argv_len = has_equal - current_argv;
- has_equal++;
- } else
- current_argv_len = strlen(current_argv);
-
- for (i = 0; long_options[i].name; i++) {
- /* find matching long option */
- if (strncmp(current_argv, long_options[i].name,
- current_argv_len))
- continue;
-
- if (strlen(long_options[i].name) == current_argv_len) {
- /* exact match */
- match = i;
- exact_match = 1;
- break;
- }
- /*
- * If this is a known short option, don't allow
- * a partial match of a single character.
- */
- if (short_too && current_argv_len == 1)
- continue;
-
- if (match == -1) /* first partial match */
- match = i;
- else if ((flags & FLAG_LONGONLY) ||
- long_options[i].has_arg !=
- long_options[match].has_arg ||
- long_options[i].flag != long_options[match].flag ||
- long_options[i].val != long_options[match].val)
- second_partial_match = 1;
- }
- if (!exact_match && second_partial_match) {
- /* ambiguous abbreviation */
- if (PRINT_ERROR) {
- fprintf(stderr, ambig,
-#ifdef GNU_COMPATIBLE
- current_dash,
-#endif
- (int)current_argv_len,
- current_argv);
- }
- optopt = 0;
- return (BADCH);
- }
- if (match != -1) { /* option found */
- if (long_options[match].has_arg == no_argument
- && has_equal) {
- if (PRINT_ERROR) {
- fprintf(stderr, noarg,
-#ifdef GNU_COMPATIBLE
- current_dash,
-#endif
- (int)current_argv_len,
- current_argv);
- }
- /*
- * XXX: GNU sets optopt to val regardless of flag
- */
- if (long_options[match].flag == NULL)
- optopt = long_options[match].val;
- else
- optopt = 0;
-#ifdef GNU_COMPATIBLE
- return (BADCH);
-#else
- return (BADARG);
-#endif
- }
- if (long_options[match].has_arg == required_argument ||
- long_options[match].has_arg == optional_argument) {
- if (has_equal)
- optarg = has_equal;
- else if (long_options[match].has_arg ==
- required_argument) {
- /*
- * optional argument doesn't use next nargv
- */
- optarg = nargv[optind++];
- }
- }
- if ((long_options[match].has_arg == required_argument)
- && (optarg == NULL)) {
- /*
- * Missing argument; leading ':' indicates no error
- * should be generated.
- */
- if (PRINT_ERROR) {
- fprintf(stderr, recargstring,
-#ifdef GNU_COMPATIBLE
- current_dash,
-#endif
- current_argv);
- }
- /*
- * XXX: GNU sets optopt to val regardless of flag
- */
- if (long_options[match].flag == NULL)
- optopt = long_options[match].val;
- else
- optopt = 0;
- --optind;
- return (BADARG);
- }
- } else { /* unknown option */
- if (short_too) {
- --optind;
- return (-1);
- }
- if (PRINT_ERROR) {
- fprintf(stderr, illoptstring,
-#ifdef GNU_COMPATIBLE
- current_dash,
-#endif
- current_argv);
- }
- optopt = 0;
- return (BADCH);
- }
- if (idx)
- *idx = match;
- if (long_options[match].flag) {
- *long_options[match].flag = long_options[match].val;
- return (0);
- } else
- return (long_options[match].val);
-}
-
-/*
- * getopt_internal --
- * Parse argc/argv argument vector. Called by user level routines.
- */
-static int
-getopt_internal(int nargc, char * const *nargv, const char *options,
- const struct option *long_options, int *idx, int flags)
-{
- char *oli; /* option letter list index */
- int optchar, short_too;
- int posixly_correct; /* no static, can be changed on the fly */
-
- if (options == NULL)
- return (-1);
-
- /*
- * Disable GNU extensions if POSIXLY_CORRECT is set or options
- * string begins with a '+'.
- */
- posixly_correct = (getenv("POSIXLY_CORRECT") != NULL);
-#ifdef GNU_COMPATIBLE
- if (*options == '-')
- flags |= FLAG_ALLARGS;
- else if (posixly_correct || *options == '+')
- flags &= ~FLAG_PERMUTE;
-#else
- if (posixly_correct || *options == '+')
- flags &= ~FLAG_PERMUTE;
- else if (*options == '-')
- flags |= FLAG_ALLARGS;
-#endif
-#if HAVE_STRICT_MODE >= 1
- flags &= ~FLAG_PERMUTE;
-#endif
- if (*options == '+' || *options == '-')
- options++;
-
- /*
- * XXX Some GNU programs (like cvs) set optind to 0 instead of
- * XXX using optreset. Work around this braindamage.
- */
- if (optind == 0)
- optind = optreset = 1;
-
- optarg = NULL;
- if (optreset)
- nonopt_start = nonopt_end = -1;
-start:
- if (optreset || !*place) { /* update scanning pointer */
- optreset = 0;
- if (optind >= nargc) { /* end of argument vector */
- place = EMSG;
- if (nonopt_end != -1) {
- /* do permutation, if we have to */
- permute_args(nonopt_start, nonopt_end,
- optind, nargv);
- optind -= nonopt_end - nonopt_start;
- }
- else if (nonopt_start != -1) {
- /*
- * If we skipped non-options, set optind
- * to the first of them.
- */
- optind = nonopt_start;
- }
- nonopt_start = nonopt_end = -1;
- return (-1);
- }
- if (*(place = nargv[optind]) != '-' ||
-#ifdef GNU_COMPATIBLE
- place[1] == '\0') {
-#else
- (place[1] == '\0' && strchr(options, '-') == NULL)) {
-#endif
- place = EMSG; /* found non-option */
- if (flags & FLAG_ALLARGS) {
- /*
- * GNU extension:
- * return non-option as argument to option 1
- */
- optarg = nargv[optind++];
- return (INORDER);
- }
- if (!(flags & FLAG_PERMUTE)) {
- /*
- * If no permutation wanted, stop parsing
- * at first non-option.
- */
- return (-1);
- }
- /* do permutation */
- if (nonopt_start == -1)
- nonopt_start = optind;
- else if (nonopt_end != -1) {
- permute_args(nonopt_start, nonopt_end,
- optind, nargv);
- nonopt_start = optind -
- (nonopt_end - nonopt_start);
- nonopt_end = -1;
- }
- optind++;
- /* process next argument */
- goto start;
- }
- if (nonopt_start != -1 && nonopt_end == -1)
- nonopt_end = optind;
-
- /*
- * If we have "-" do nothing, if "--" we are done.
- */
- if (place[1] != '\0' && *++place == '-' && place[1] == '\0') {
- optind++;
- place = EMSG;
- /*
- * We found an option (--), so if we skipped
- * non-options, we have to permute.
- */
- if (nonopt_end != -1) {
- permute_args(nonopt_start, nonopt_end,
- optind, nargv);
- optind -= nonopt_end - nonopt_start;
- }
- nonopt_start = nonopt_end = -1;
- return (-1);
- }
- }
-
- /*
- * Check long options if:
- * 1) we were passed some
- * 2) the arg is not just "-"
- * 3) either the arg starts with -- we are getopt_long_only()
- */
- if (long_options != NULL && place != nargv[optind] &&
- (*place == '-' || (flags & FLAG_LONGONLY))) {
- short_too = 0;
-#ifdef GNU_COMPATIBLE
- dash_prefix = D_PREFIX;
-#endif
- if (*place == '-') {
- place++; /* --foo long option */
-#ifdef GNU_COMPATIBLE
- dash_prefix = DD_PREFIX;
-#endif
- } else if (*place != ':' && strchr(options, *place) != NULL)
- short_too = 1; /* could be short option too */
-
- optchar = parse_long_options(nargv, options, long_options,
- idx, short_too, flags);
- if (optchar != -1) {
- place = EMSG;
- return (optchar);
- }
- }
-
- if ((optchar = (int)*place++) == (int)':' ||
- (optchar == (int)'-' && *place != '\0') ||
- (oli = strchr(options, optchar)) == NULL) {
- /*
- * If the user specified "-" and '-' isn't listed in
- * options, return -1 (non-option) as per POSIX.
- * Otherwise, it is an unknown option character (or ':').
- */
- if (optchar == (int)'-' && *place == '\0')
- return (-1);
- if (!*place)
- ++optind;
-#ifdef GNU_COMPATIBLE
- if (PRINT_ERROR) {
- fprintf(stderr, posixly_correct ? illoptchar : gnuoptchar,
- optchar);
- }
-#else
- if (PRINT_ERROR) {
- fprintf(stderr, illoptchar, optchar);
- }
-#endif
- optopt = optchar;
- return (BADCH);
- }
- if (long_options != NULL && optchar == 'W' && oli[1] == ';') {
- /* -W long-option */
- if (*place) /* no space */
- /* NOTHING */;
- else if (++optind >= nargc) { /* no arg */
- place = EMSG;
- if (PRINT_ERROR) {
- fprintf(stderr, recargchar, optchar);
- }
- optopt = optchar;
- return (BADARG);
- } else /* white space */
- place = nargv[optind];
-#ifdef GNU_COMPATIBLE
- dash_prefix = W_PREFIX;
-#endif
- optchar = parse_long_options(nargv, options, long_options,
- idx, 0, flags);
- place = EMSG;
- return (optchar);
- }
- if (*++oli != ':') { /* doesn't take argument */
- if (!*place)
- ++optind;
- } else { /* takes (optional) argument */
- optarg = NULL;
- if (*place) /* no white space */
- optarg = place;
- else if (oli[1] != ':') { /* arg not optional */
- if (++optind >= nargc) { /* no arg */
- place = EMSG;
- if (PRINT_ERROR) {
- fprintf(stderr, recargchar, optchar);
- }
- optopt = optchar;
- return (BADARG);
- } else
- optarg = nargv[optind];
- }
- place = EMSG;
- ++optind;
- }
- /* dump back option letter */
- return (optchar);
-}
-
-/*
- * getopt --
- * Parse argc/argv argument vector.
- *
- * [eventually this will replace the BSD getopt]
- */
-int
-getopt(int nargc, char * const *nargv, const char *options)
-{
-
- /*
- * We don't pass FLAG_PERMUTE to getopt_internal() since
- * the BSD getopt(3) (unlike GNU) has never done this.
- *
- * Furthermore, since many privileged programs call getopt()
- * before dropping privileges it makes sense to keep things
- * as simple (and bug-free) as possible.
- */
- return (getopt_internal(nargc, nargv, options, NULL, NULL, 0));
-}
-
-/*
- * getopt_long --
- * Parse argc/argv argument vector.
- */
-int
-getopt_long(int nargc, char * const *nargv, const char *options,
- const struct option *long_options, int *idx)
-{
-
- return (getopt_internal(nargc, nargv, options, long_options, idx,
- FLAG_PERMUTE));
-}
-
-/*
- * getopt_long_only --
- * Parse argc/argv argument vector.
- */
-int
-getopt_long_only(int nargc, char * const *nargv, const char *options,
- const struct option *long_options, int *idx)
-{
-
- return (getopt_internal(nargc, nargv, options, long_options, idx,
- FLAG_PERMUTE|FLAG_LONGONLY));
-}