summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorCharles-François Natali <neologix@free.fr>2012-01-08 18:07:18 (GMT)
committerCharles-François Natali <neologix@free.fr>2012-01-08 18:07:18 (GMT)
commit38f425e4756142ea03267ad0790bee7417461db9 (patch)
tree642fe97b6a3f2d1db2a09441dc71720349eb6877 /Modules/posixmodule.c
parent7546ad327d8aff40314154650d9540cd396a2678 (diff)
downloadcpython-38f425e4756142ea03267ad0790bee7417461db9.zip
cpython-38f425e4756142ea03267ad0790bee7417461db9.tar.gz
cpython-38f425e4756142ea03267ad0790bee7417461db9.tar.bz2
Issue #13739: It's simpler and more direct to call rewinddir() at the
beginning.
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 3c723cf..602c422 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