diff options
Diffstat (limited to 'sys-freebsd/freebsd-lib/files/freebsd-lib-7.1-strndup_bport.patch')
-rw-r--r-- | sys-freebsd/freebsd-lib/files/freebsd-lib-7.1-strndup_bport.patch | 151 |
1 files changed, 0 insertions, 151 deletions
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-7.1-strndup_bport.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-7.1-strndup_bport.patch deleted file mode 100644 index b4eab1e7ff49..000000000000 --- a/sys-freebsd/freebsd-lib/files/freebsd-lib-7.1-strndup_bport.patch +++ /dev/null @@ -1,151 +0,0 @@ -Backport of strndup from -CURRENT. - -Fixes bugs 249731 and 256741. - -According to the manpage this will appear on 8.0, -so try to keep it around. ---- lib.orig/libc/string/Makefile.inc -+++ lib/libc/string/Makefile.inc -@@ -9,9 +9,9 @@ - MISRCS+=bcmp.c bcopy.c bzero.c ffs.c ffsl.c ffsll.c fls.c flsl.c flsll.c \ - index.c memccpy.c memchr.c memrchr.c memcmp.c \ - memcpy.c memmem.c memmove.c memset.c rindex.c stpcpy.c strcasecmp.c \ -- strcat.c strchr.c strcmp.c strcoll.c strcpy.c strcspn.c strdup.c \ -- strerror.c strlcat.c strlcpy.c strlen.c strmode.c strncat.c strncmp.c \ -- strncpy.c strcasestr.c strnstr.c \ -+ strcat.c strcasestr.c strchr.c strcmp.c strcoll.c strcpy.c strcspn.c \ -+ strdup.c strerror.c strlcat.c strlcpy.c strlen.c strmode.c strncat.c \ -+ strncmp.c strncpy.c strndup.c strnstr.c \ - strpbrk.c strrchr.c strsep.c strsignal.c strspn.c strstr.c strtok.c \ - strxfrm.c swab.c wcscat.c wcschr.c wcscmp.c wcscoll.c wcscpy.c \ - wcscspn.c wcsdup.c \ -@@ -47,6 +47,7 @@ - MLINKS+=strchr.3 strrchr.3 - MLINKS+=strcmp.3 strncmp.3 - MLINKS+=strcpy.3 stpcpy.3 -+MLINKS+=strdup.3 strndup.3 - MLINKS+=strcpy.3 strncpy.3 - MLINKS+=strerror.3 perror.3 strerror.3 sys_errlist.3 strerror.3 sys_nerr.3 - MLINKS+=strerror.3 strerror_r.3 ---- lib.orig/libc/string/Symbol.map -+++ lib/libc/string/Symbol.map -@@ -81,6 +81,7 @@ - ffsll; - flsll; - memrchr; -+ strndup; - }; - - FBSDprivate_1.0 { ---- lib.orig/libc/string/strdup.3 -+++ lib/libc/string/strdup.3 -@@ -32,7 +32,8 @@ - .Dt STRDUP 3 - .Os - .Sh NAME --.Nm strdup -+.Nm strdup , -+.Nm strndup - .Nd save a copy of a string - .Sh LIBRARY - .Lb libc -@@ -40,6 +41,8 @@ - .In string.h - .Ft char * - .Fn strdup "const char *str" -+.Ft char * -+.Fn strndup "const char *str" "size_t len" - .Sh DESCRIPTION - The - .Fn strdup -@@ -56,6 +59,16 @@ - .Va errno - is set to - .Er ENOMEM . -+.Pp -+The -+.Fn strndup -+function copies at most -+.Fa len -+characters from the string -+.Fa str -+always -+.Dv NUL -+terminating the copied string. - .Sh SEE ALSO - .Xr free 3 , - .Xr malloc 3 -@@ -64,3 +77,7 @@ - .Fn strdup - function first appeared in - .Bx 4.4 . -+The -+.Fn strndup -+function was added in -+.Fx 8.0 . ---- lib.orig/libc/string/strndup.c -+++ lib/libc/string/strndup.c -@@ -0,0 +1,53 @@ -+/* $NetBSD: strndup.c,v 1.3 2007/01/14 23:41:24 cbiere Exp $ */ -+ -+/* -+ * Copyright (c) 1988, 1993 -+ * The Regents of the University of California. All rights reserved. -+ * -+ * 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. -+ * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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. -+ */ -+ -+#include <sys/cdefs.h> -+__FBSDID("$FreeBSD: src/lib/libc/string/strndup.c,v 1.1.2.1 2009/01/08 09:50:20 kib Exp $"); -+ -+#include <stddef.h> -+#include <stdlib.h> -+#include <string.h> -+ -+char * -+strndup(const char *str, size_t n) -+{ -+ size_t len; -+ char *copy; -+ -+ for (len = 0; len < n && str[len]; len++) -+ continue; -+ -+ if ((copy = malloc(len + 1)) == NULL) -+ return (NULL); -+ memcpy(copy, str, len); -+ copy[len] = '\0'; -+ return (copy); -+} ---- include.orig/string.h -+++ include/string.h -@@ -96,6 +96,7 @@ - int strncmp(const char *, const char *, size_t) __pure; - char *strncpy(char * __restrict, const char * __restrict, size_t); - #if __BSD_VISIBLE -+char *strndup(const char *, size_t); - char *strnstr(const char *, const char *, size_t) __pure; - #endif - char *strpbrk(const char *, const char *) __pure; |