[Wifidog] thread unsafe calls

David Vincelli rmx at bellnet.ca
Fri Oct 22 21:10:03 EDT 2004


Hi everyone,

I was just taking a look at wifidog's thread functions again.
I see in ping_thread.c, a call to gethostbyname(), according to the
pthreads man page (openbsd) this call is not thread safe.

Workaround: resolve the names at init, store the values in a
data structure.

Implications: auth server must have a static IP.

Note that I have not looked for all calls listed as unsafe in 
pthreads(3) - I'll try to run a grep with all the functions as keywords.

Also, minor and probably irrelevant detail: snprintf() returns -1 on
error or the size of the string pasted in the buffer if succesful.
You guys aren't doing any error checking. It might be important.
You never know, especially on an embedded platform with "limited"
capacity.

Comments,

--
dave

_______________________________________________
Wifidog mailing list
Wifidog at isf.waglo.com
http://isf.waglo.com/mailman/listinfo/wifidog_isf.waglo.com



More information about the Wifidog mailing list