summaryrefslogtreecommitdiffstats
path: root/newlib/libc/stdio/makebuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdio/makebuf.c')
-rw-r--r--newlib/libc/stdio/makebuf.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/newlib/libc/stdio/makebuf.c b/newlib/libc/stdio/makebuf.c
index c4d03ecb6..9808cd5ec 100644
--- a/newlib/libc/stdio/makebuf.c
+++ b/newlib/libc/stdio/makebuf.c
@@ -24,6 +24,8 @@
#include <sys/unistd.h>
#include "local.h"
+#define _DEFAULT_ASPRINTF_BUFSIZE 64
+
/*
* Allocate a file buffer, or switch to unbuffered I/O.
* Per the ANSI C standard, ALL tty devices default to line buffered.
@@ -53,7 +55,11 @@ _DEFUN(__smakebuf, (fp),
#endif
{
couldbetty = 0;
- size = BUFSIZ;
+ /* Check if we are be called by asprintf family for initial buffer. */
+ if (fp->_flags & __SMBF)
+ size = _DEFAULT_ASPRINTF_BUFSIZE;
+ else
+ size = BUFSIZ;
/* do not try to optimise fseek() */
fp->_flags |= __SNPT;
}