summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorCharles-François Natali <neologix@free.fr>2012-01-08 17:34:06 (GMT)
committerCharles-François Natali <neologix@free.fr>2012-01-08 17:34:06 (GMT)
commit7546ad327d8aff40314154650d9540cd396a2678 (patch)
tree3d9f4aab8a88410d4efdd062d569735c230bfc42 /Modules/posixmodule.c
parent94f6fa62bf111916a44e336c25deeac2c490ec98 (diff)
downloadcpython-7546ad327d8aff40314154650d9540cd396a2678.zip
cpython-7546ad327d8aff40314154650d9540cd396a2678.tar.gz
cpython-7546ad327d8aff40314154650d9540cd396a2678.tar.bz2
Issue #13739: In os.listdir(), rewind the directory stream (so that listdir()
can be called again on the same open file).
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index ea3665d..3c723cf 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -2906,6 +2906,7 @@ posix_fdlistdir(PyObject *self, PyObject *args)
break;
} else {
Py_BEGIN_ALLOW_THREADS
+ rewinddir(dirp);
closedir(dirp);
Py_END_ALLOW_THREADS
Py_DECREF(d);
@@ -2929,6 +2930,7 @@ posix_fdlistdir(PyObject *self, PyObject *args)
Py_DECREF(v);
}
Py_BEGIN_ALLOW_THREADS
+ rewinddir(dirp);
closedir(dirp);
Py_END_ALLOW_THREADS