Daniel P. Berrange wrote: > > /* This lock protects the buffer returned by strerror(). We assume that > > no other uses of strerror() exist in the program. */ > > gl_lock_define_initialized(static, strerror_lock) > > It'd be good to have an impl that uses strerror_s() on Win32 > since I don't think it is safe to assume that all other libraries > linked against will have strerror() usage protected by the gnulib > lock.
When you have a multithreaded program, you must ensure that all parts of the program avoid to use functions with global side effects, like setlocale, gethostname, sterrror, and similar. If a program uses strerror in just one thread and strerror_r in the other threads, you will have also a portability problem on HP-UX 11.23 and Solaris 9, not only mingw. Therefore using strerror_s() is not a complete fix. Also, strerror_s() did not exist in MSVC7 and is therefore not declared in (at least some versions of) the mingw headers. Bruno
