[Wifidog] thread unsafe calls

Alexandre Carmel-Veilleux saruman at northernhacking.org
Fri Oct 22 21:06:46 EDT 2004

On Fri, Oct 22, 2004 at 09:10:03PM -0400, David Vincelli wrote:
> 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.

	Alternative #2, a wrapper function with a mutex.

	I'll write this and check it in.

> 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.

	snprintf() should never return -1. It should return the total
number of characters copied into the string. asprintf() returns -1 when
malloc fails. Or so says the Darwin man pages.


-------------- next part --------------
Wifidog mailing list
Wifidog at isf.waglo.com

More information about the Wifidog mailing list