Loading...
--- Libc/Libc-825.25/stdio/FreeBSD/makebuf.c
+++ Libc/Libc-763.12/stdio/FreeBSD/makebuf.c
@@ -47,9 +47,6 @@
#include "libc_private.h"
#include "local.h"
-#define MAXBUFSIZE (1 << 16)
-#define TTYBUFSIZE 4096
-
/*
* Allocate a file buffer, or switch to unbuffered I/O.
* Per the ANSI C standard, ALL tty devices default to line buffered.
@@ -72,12 +69,6 @@
return;
}
flags = __swhatbuf(fp, &size, &couldbetty);
- if (couldbetty && isatty(fp->_file)) {
- flags |= __SLBF;
- /* st_blksize for ttys is 128K, so make it more reasonable */
- if (size > TTYBUFSIZE)
- fp->_blksize = size = TTYBUFSIZE;
- }
if ((p = malloc(size)) == NULL) {
fp->_flags |= __SNBF;
fp->_bf._base = fp->_p = fp->_nbuf;
@@ -88,6 +79,8 @@
flags |= __SMBF;
fp->_bf._base = fp->_p = p;
fp->_bf._size = size;
+ if (couldbetty && isatty(fp->_file))
+ flags |= __SLBF;
fp->_flags |= flags;
}
@@ -120,7 +113,8 @@
* __sseek is mainly paranoia.) It is safe to set _blksize
* unconditionally; it will only be used if __SOPT is also set.
*/
- fp->_blksize = *bufsize = st.st_blksize > MAXBUFSIZE ? MAXBUFSIZE : st.st_blksize;
+ *bufsize = st.st_blksize;
+ fp->_blksize = st.st_blksize;
return ((st.st_mode & S_IFMT) == S_IFREG && fp->_seek == __sseek ?
__SOPT : __SNPT);
}