I am fixing Linux code that used strerror (not thread safe) for multithreading. I found that strerror_r and strerror_l are thread safe. Due to different definitions for strerror_r (depending on _GNU_SOURCE this is differently defined) I would like to use the new strerror_l function, but how should I get the locale_t object for the current locale? I don’t use iconv or anything else, just libc, and I don’t see how I can get the “default locale” object (I don’t care what language the error is printed in, I just need a person to read the line.)
source share