Rock Li added the comment:

Hi Ross, 

What about if one implementation of posix use the global variable to store 
something. From `man readdir`, I didn't see the sentence "This data is not 
overwritten by another call to readdir() on a different directory stream.".

And from the link you gived, 
""
Background

The POSIX readdir_r function is a thread-safe version of the readdir function 
used to read directory entries. Whereas readdir returns a pointer to a 
system-allocated buffer and may use global state without mutual exclusion, 
readdir_r uses a user-supplied buffer and is guaranteed to be reentrant. Its 
use is therefore preferable or even essential in portable multithreaded 
programs.
""

Actually readdir_r is guaranteed to be reentrant. By using readdir, I think 
just like to use errno in a multi thread programs, we can't always think it 
will work as the right way. But readdir_r, we can. 

And another question, you say 
"struct dirent should not be allocated on the stack since the last field may be 
an unspecified size."

What does this mean? Can you explain detail to me?
Thx.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17428>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to