Loading...
stdio/FreeBSD/vasprintf.c.patch Libc-391 /dev/null
--- Libc/Libc-391/stdio/FreeBSD/vasprintf.c.patch
+++ /dev/null
@@ -1,55 +0,0 @@
---- vasprintf.c.orig	2003-05-20 15:22:44.000000000 -0700
-+++ vasprintf.c	2005-02-23 18:55:18.000000000 -0800
-@@ -30,6 +30,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/vasprintf.c,v 1.18 2002/09/26 13:11:24 tjr Exp $");
- 
-+#include "xlocale_private.h"
-+
- #include <stdio.h>
- #include <stdlib.h>
- #include <errno.h>
-@@ -56,7 +58,42 @@
- 	f._bf._size = f._w = 127;		/* Leave room for the NUL */
- 	f._extra = &ext;
- 	INITEXTRA(&f);
--	ret = __vfprintf(&f, fmt, ap);
-+	ret = __vfprintf(&f, __current_locale(), fmt, 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
-+vasprintf_l(str, loc, fmt, ap)
-+	char **str;
-+	locale_t loc;
-+	const char *fmt;
-+	__va_list ap;
-+{
-+	int ret;
-+	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);
-+	ret = __vfprintf(&f, loc, fmt, ap);
- 	if (ret < 0) {
- 		free(f._bf._base);
- 		*str = NULL;