This is the mail archive of the
mailing list for the Cygwin project.
Re: PATCH: Implementation of functions in netdb.h
On Wed, Dec 04, 2002 at 01:55:49PM +0100, Corinna Vinschen wrote:
>On Wed, Dec 04, 2002 at 10:44:40PM +1300, Craig McGeachie wrote:
>>N.B. This routine relies on side effects due to the nature of
>>strtok(). strtok() initially takes a char * pointing to the start of a
>>line, and then NULL to indicate continued processing. strtok() does
>>not provide a mechanism for getting pointer to the unprocessed portion
>>of a line. Alias processing is done part way through a line after
>>strtok(). This routine relies on further calls to strtok(), passing
>>NULL as the first parameter, returning alias names from the line. */
>please use strtok_r(). It helps to avoid clashes with the application
>using strtok() as well.
Right. There are other potential thread problems in this code, too.
However, I've checked it with some minor formatting changes. I'd
appreciate if you (Craig) would consider making this thread safe. That
means eliminating the use of statics, for the most part and using
strtok_r, etc. It's not a simple job by any means but maybe the code in
perthread.h will provide a clue.
Thanks for your contribution, Craig!