Loading...
stdio/FreeBSD/asprintf.c.patch Libc-391.4.3 /dev/null
--- Libc/Libc-391.4.3/stdio/FreeBSD/asprintf.c.patch
+++ /dev/null
@@ -1,54 +0,0 @@
---- asprintf.c.orig	2003-05-20 15:22:40.000000000 -0700
-+++ asprintf.c	2005-02-23 16:17:23.000000000 -0800
-@@ -30,6 +30,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/asprintf.c,v 1.13 2002/09/26 13:09:48 tjr Exp $");
- 
-+#include "xlocale_private.h"
-+
- #include <stdio.h>
- #include <stdlib.h>
- #include <errno.h>
-@@ -57,7 +59,41 @@
- 	f._extra = &ext;
- 	INITEXTRA(&f);
- 	va_start(ap, fmt);
--	ret = __vfprintf(&f, fmt, ap);		/* Use unlocked __vfprintf */
-+	ret = __vfprintf(&f, __current_locale(), fmt, ap);	/* Use unlocked __vfprintf */
-+	va_end(ap);
-+	if (ret < 0) {
-+		free(f._bf._base);
-+		*str = NULL;
-+		errno = ENOMEM;
-+		return (-1);
-+	}
-+	*f._p = '\0';
-+	*str = (char *)f._bf._base;
-+	return (ret);
-+}
-+
-+int
-+asprintf_l(char **str, locale_t loc, char const *fmt, ...)
-+{
-+	int ret;
-+	va_list ap;
-+	FILE f;
-+	struct __sFILEX ext;
-+
-+	NORMALIZE_LOCALE(loc);
-+	f._file = -1;
-+	f._flags = __SWR | __SSTR | __SALC;
-+	f._bf._base = f._p = (unsigned char *)malloc(128);
-+	if (f._bf._base == NULL) {
-+		*str = NULL;
-+		errno = ENOMEM;
-+		return (-1);
-+	}
-+	f._bf._size = f._w = 127;		/* Leave room for the NUL */
-+	f._extra = &ext;
-+	INITEXTRA(&f);
-+	va_start(ap, fmt);
-+	ret = __vfprintf(&f, loc, fmt, ap);	/* Use unlocked __vfprintf */
- 	va_end(ap);
- 	if (ret < 0) {
- 		free(f._bf._base);