]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #13739: It's simpler and more direct to call rewinddir() at the
authorCharles-François Natali <neologix@free.fr>
Sun, 8 Jan 2012 18:07:18 +0000 (19:07 +0100)
committerCharles-François Natali <neologix@free.fr>
Sun, 8 Jan 2012 18:07:18 +0000 (19:07 +0100)
beginning.

Modules/posixmodule.c

index 3c723cf28837f0a0026de7a472fd3419606bd3c1..602c4222dd1e1670e84d2da6c228bb1a2e39dbfc 100644 (file)
@@ -2890,6 +2890,7 @@ posix_fdlistdir(PyObject *self, PyObject *args)
         close(fd);
         return posix_error();
     }
+    rewinddir(dirp);
     if ((d = PyList_New(0)) == NULL) {
         Py_BEGIN_ALLOW_THREADS
         closedir(dirp);
@@ -2906,7 +2907,6 @@ posix_fdlistdir(PyObject *self, PyObject *args)
                 break;
             } else {
                 Py_BEGIN_ALLOW_THREADS
-                rewinddir(dirp);
                 closedir(dirp);
                 Py_END_ALLOW_THREADS
                 Py_DECREF(d);
@@ -2930,7 +2930,6 @@ posix_fdlistdir(PyObject *self, PyObject *args)
         Py_DECREF(v);
     }
     Py_BEGIN_ALLOW_THREADS
-    rewinddir(dirp);
     closedir(dirp);
     Py_END_ALLOW_THREADS