fix strnstr for msys2-runtime
This commit is contained in:
48
msys2-runtime/0024-fix-strnstr-for-msys2-runtime.patch
Normal file
48
msys2-runtime/0024-fix-strnstr-for-msys2-runtime.patch
Normal file
@@ -0,0 +1,48 @@
|
||||
From 19d66febd492f64916126d75d7afd52c5c2870ef Mon Sep 17 00:00:00 2001
|
||||
From: Holger Nahrstaedt <holger@nahrstaedt.de>
|
||||
Date: Wed, 13 Sep 2017 14:23:09 +0200
|
||||
Subject: [PATCH 24/24] fix strnstr for msys2-runtime
|
||||
|
||||
---
|
||||
newlib/libc/string/strnstr.c | 26 +++++++++++++++++---------
|
||||
1 file changed, 17 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/newlib/libc/string/strnstr.c b/newlib/libc/string/strnstr.c
|
||||
index ce32d0f73..5ac684afd 100644
|
||||
--- a/newlib/libc/string/strnstr.c
|
||||
+++ b/newlib/libc/string/strnstr.c
|
||||
@@ -39,14 +39,22 @@ QUICKREF
|
||||
* first slen characters of s.
|
||||
*/
|
||||
char *
|
||||
-strnstr(const char *haystack, const char *needle, size_t haystack_len)
|
||||
+strnstr(const char *s, const char *find, size_t slen)
|
||||
{
|
||||
- size_t needle_len = strnlen(needle, haystack_len);
|
||||
-
|
||||
- if (needle_len < haystack_len || !needle[needle_len]) {
|
||||
- char *x = memmem(haystack, haystack_len, needle, needle_len);
|
||||
- if (x && !memchr(haystack, 0, x - haystack))
|
||||
- return x;
|
||||
- }
|
||||
- return NULL;
|
||||
+ char c, sc;
|
||||
+ size_t len;
|
||||
+
|
||||
+ if ((c = *find++) != '\0') {
|
||||
+ len = strlen(find);
|
||||
+ do {
|
||||
+ do {
|
||||
+ if (slen-- < 1 || (sc = *s++) == '\0')
|
||||
+ return (NULL);
|
||||
+ } while (sc != c);
|
||||
+ if (len > slen)
|
||||
+ return (NULL);
|
||||
+ } while (strncmp(s, find, len) != 0);
|
||||
+ s--;
|
||||
+ }
|
||||
+ return ((char *)s);
|
||||
}
|
||||
--
|
||||
2.14.1
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
pkgbase=msys2-runtime
|
||||
pkgname=('msys2-runtime' 'msys2-runtime-devel')
|
||||
pkgver=2.9.0
|
||||
pkgrel=1
|
||||
pkgrel=9
|
||||
# 5 broken
|
||||
pkgdesc="Cygwin POSIX emulation engine"
|
||||
arch=('i686' 'x86_64')
|
||||
url="https://www.cygwin.com/"
|
||||
@@ -22,6 +23,12 @@ makedepends=('cocom'
|
||||
'libiconv-devel'
|
||||
'diffutils')
|
||||
# options=('debug' '!strip')
|
||||
#source=('msys2-runtime'::git://sourceware.org/git/newlib-cygwin.git#commit=4dfaef81414f006377ed235a995c7b2d8dcdcb95
|
||||
#broken
|
||||
#source=('msys2-runtime'::git://sourceware.org/git/newlib-cygwin.git#commit=42885ea4b8bfece01cac0a4a4030ff4341454353
|
||||
#source=('msys2-runtime'::git://sourceware.org/git/newlib-cygwin.git#commit=f22054c94d3f77ba834d55123ffa9fe4aef6f93c
|
||||
#not boken
|
||||
#source=('msys2-runtime'::git://sourceware.org/git/newlib-cygwin.git#commit=cdbec10e7914748792371512d4485a9d868fe549
|
||||
source=('msys2-runtime'::git://sourceware.org/git/newlib-cygwin.git#tag=cygwin-${pkgver//./_}-release
|
||||
0001-Add-MSYS-triplets.patch
|
||||
0002-Rename-DLL-from-cygwin-to-msys.patch
|
||||
@@ -45,7 +52,8 @@ source=('msys2-runtime'::git://sourceware.org/git/newlib-cygwin.git#tag=cygwin-$
|
||||
0020-Add-debugging-for-build_argv.patch
|
||||
0021-Add-debugging-for-strace-make_command_line.patch
|
||||
0022-environ.cc-New-facility-environment-variable-MSYS2_E.patch
|
||||
0023-path.cc-Ignore-zero-length-exclusions.patch)
|
||||
0023-path.cc-Ignore-zero-length-exclusions.patch
|
||||
0024-fix-strnstr-for-msys2-runtime.patch)
|
||||
sha256sums=('SKIP'
|
||||
'b1c5301bbb7a99b69ad6e5cb89f383f59d349ec7c7913060213c78d4550c7bb7'
|
||||
'2049ac99ae716f07d1e9e2874d2d3e902b19171a6c84fe582e136d68e094f47c'
|
||||
@@ -69,7 +77,8 @@ sha256sums=('SKIP'
|
||||
'9e844186fb1e0cb7612a412968623c8ab2339a6dd768927733a571672a2bfb54'
|
||||
'a7866fd6bf627477b52112a24d5504fb75678e334c9cd283f176d5820b1dea55'
|
||||
'7afc2bac55c3db92a7f849a497113d82be7966d3e8bb4793e30ed006ef7229e0'
|
||||
'98ff1fb66a962ab2365222333acd6b148d44d47fd919971fea81f2ba4482b6f5')
|
||||
'98ff1fb66a962ab2365222333acd6b148d44d47fd919971fea81f2ba4482b6f5'
|
||||
'5acbfff1fcde736fde17bd2c2f981b0ccb530250b201edd2036375a63c2893df')
|
||||
|
||||
# Helper macros to help make tasks easier #
|
||||
apply_patch_with_msg() {
|
||||
@@ -124,7 +133,8 @@ prepare() {
|
||||
0020-Add-debugging-for-build_argv.patch \
|
||||
0021-Add-debugging-for-strace-make_command_line.patch \
|
||||
0022-environ.cc-New-facility-environment-variable-MSYS2_E.patch \
|
||||
0023-path.cc-Ignore-zero-length-exclusions.patch
|
||||
0023-path.cc-Ignore-zero-length-exclusions.patch \
|
||||
0024-fix-strnstr-for-msys2-runtime.patch
|
||||
}
|
||||
|
||||
build() {
|
||||
|
||||
Reference in New Issue
Block a user