> From: Christopher Schultz [mailto:ch...@christopherschultz.net] > Subject: Re: APR/native errors with non-blocking I/O
> I'm pretty sure that sterror is thread safe: it should just return a > static char*. Would that it were that simple. Seriously, it's not thread safe; a second thread calling the API can overlay a prior thread's message. If it were thread safe, GNU wouldn't have bothered with the _r alternative. > "For unknown error numbers, the strerror() function will return its > result in a static buffer which may be overwritten by subsequent calls." > Hopefully, that means static and private to the thread, but I don't know. Nope, it's static and global. > Back to the GNU man page, it says: "strerror() is specified by > POSIX.1-2001, C89, C99. strerror_r() is specified by POSIX.1-2001.", so > we may be able to rely upon it. Yes, the _r alternative is available on many (probably most, these days) platforms, but it's by no means universal. (On another mailing list, we had someone still trying to use gcc 3.3...) - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org