Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make crypt and crypt_gensalt use thread-local output buffers.
This change makes crypt and crypt_gensalt as thread-safe as they can be without changing their interfaces. Solaris already made this change, and it’s being discussed by glibc (with suggestion that it should be pushed upstream to the C and POSIX standards committees): https://sourceware.org/ml/libc-alpha/2018-10/msg00437.html Portable programs should still use the r-variants, though, because this is not a guaranteed feature, it doesn’t make them not clobber their output buffers on a second call from within the same thread, and the tradeoff is a some overhead for initializing a buffer of `sizeof (crypt_data)` and for copying the computed output to the thread-local output buffer for each invocation of the crypt function.
- Loading branch information