> Doh. I see it doesn't write to it. Nevertheless, seems like a bad
> piece of code - its assuming errno is thread local, right?
>

This code uses the address of errno as a default thread ID for OpenSSL
purposes. This works precisely because you typically have something like
#define errno (*__error()) where the given function returns a
thread-specific pointer, although the relevant standards don't guarantee
that.  (Obviously different thread's instances of errno aren't allowed to
interfere with each other, but the standards don't say how that's
achieved.) We don't promise that this works everywhere, we just offer this
as a default.

Reply via email to