When we have no setvbuf(), make the file totally unbuffered using

setbuf() if a buffer size of 0 or 1 byte is requested.
This commit is contained in:
Guido van Rossum 1998-03-06 15:32:40 +00:00
parent 22ffac1b1f
commit f8b4de02a4

View file

@ -165,7 +165,10 @@ PyFile_SetBufSize(f, bufsize)
}
setvbuf(((PyFileObject *)f)->f_fp, (char *)NULL,
type, bufsize);
#endif /* HAVE_SETVBUF */
#else /* !HAVE_SETVBUF */
if (bufsize <= 1)
setbuf(((PyFileObject *)f)->f_fp, (char *)NULL);
#endif /* !HAVE_SETVBUF */
}
}