[Python-checkins] r45259 - in python/trunk: Misc/NEWS Modules/posixmodule.c
Georg Brandl
g.brandl at gmx.net
Tue Apr 11 09:31:56 CEST 2006
Martin v. Löwis wrote:
> georg.brandl wrote:
>> Modified: python/trunk/Modules/posixmodule.c
>> ==============================================================================
>> --- python/trunk/Modules/posixmodule.c (original)
>> +++ python/trunk/Modules/posixmodule.c Tue Apr 11 08:47:43 2006
>> @@ -1901,6 +1901,12 @@
>> }
>> Py_DECREF(v);
>> }
>> + if (errno != 0 && d != NULL) {
>> + /* readdir() returned NULL and set errno */
>> + closedir(dirp);
>> + Py_DECREF(d);
>> + return posix_error_with_allocated_filename(name);
>> + }
>> closedir(dirp);
>> PyMem_Free(name);
>
> I believe this patch is incomplete: if readdir succeeds, errno is
> not changed. So I think errno must be set to 0 before invoking readdir,
> or else you might get bogus exceptions.
Does r45262 suffice? It sets errno = 0 before invoking opendir().
Georg
More information about the Python-checkins
mailing list