Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r64964:83f89665175e
Date: 2013-06-24 18:03 +0200
http://bitbucket.org/pypy/pypy/changeset/83f89665175e/

Log:    Shooting in the dark, but one possible reading of the man page shows
        that when readdir() returns a non-null pointer, the value of errno
        might be randomly modified.

diff --git a/rpython/rtyper/module/ll_os.py b/rpython/rtyper/module/ll_os.py
--- a/rpython/rtyper/module/ll_os.py
+++ b/rpython/rtyper/module/ll_os.py
@@ -1143,9 +1143,9 @@
                 dirp = os_opendir(path)
                 if not dirp:
                     raise OSError(rposix.get_errno(), "os_opendir failed")
-                rposix.set_errno(0)
                 result = []
                 while True:
+                    rposix.set_errno(0)
                     direntp = os_readdir(dirp)
                     if not direntp:
                         error = rposix.get_errno()
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to