]> granicus.if.org Git - python/commitdiff
In open(), only set the buffer size from st.st_blksize when it is greater
authorAntoine Pitrou <solipsis@pitrou.net>
Wed, 27 Oct 2010 19:45:43 +0000 (19:45 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Wed, 27 Oct 2010 19:45:43 +0000 (19:45 +0000)
than 1.  This matches the pure Python implementation in _pyio and should
fix a couple of failures on the NetBSD buildbot.

Modules/_io/_iomodule.c

index c0c81546542b184bb819fbb23d7703efed3f43a3..44bdac6b5cf41126a99936cdcad7f11b71967fff 100644 (file)
@@ -451,7 +451,7 @@ io_open(PyObject *self, PyObject *args, PyObject *kwds)
             if (fileno == -1 && PyErr_Occurred())
                 goto error;
 
-            if (fstat(fileno, &st) >= 0)
+            if (fstat(fileno, &st) >= 0 && st.st_blksize > 1)
                 buffering = st.st_blksize;
         }
 #endif