]> granicus.if.org Git - python/commitdiff
When we have no setvbuf(), make the file totally unbuffered using
authorGuido van Rossum <guido@python.org>
Fri, 6 Mar 1998 15:32:40 +0000 (15:32 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 6 Mar 1998 15:32:40 +0000 (15:32 +0000)
setbuf() if a buffer size of 0 or 1 byte is requested.

Objects/fileobject.c

index f8c58ba45430e0d3462584ce2c8a6831679bd83a..d07aa69e61e49c2031f429f2c67bf873fa3a4a15 100644 (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 */
        }
 }