From: Charles-François Natali Date: Sun, 8 Jan 2012 18:07:18 +0000 (+0100) Subject: Issue #13739: It's simpler and more direct to call rewinddir() at the X-Git-Tag: v3.3.0a1~456 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=38f425e4756142ea03267ad0790bee7417461db9;p=thirdparty%2FPython%2Fcpython.git Issue #13739: It's simpler and more direct to call rewinddir() at the beginning. --- diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 3c723cf28837..602c4222dd1e 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -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